onexit: add an on exit callback utility

Adds a class that executes registered callbacks in its destructor. Since
static duration objects have their destructors called when returning
from main or calling exit then this can be used as a replacement for
on_exit.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
log: use on exit manager to flush logs on exit

on_exit is not portable, and atexit doesn't allow parameters to be
passed to callbacks.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
on_exit: remove side effects from asserts

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Merge pull request #1044 from ceph/port/onexit

create on_exit replacement

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1052 from dachary/wip-large-output-daemon-config

common: fix large output in unittest_daemon_config

Reviewed-By: Christophe Courtaut <christophe.courtaut@gmail.com>
mon: shell test helpers to run MONs from sources

The intent is to make it more convenient to reproduce a specific mon
behavior and observe the result by grepping the logs. It can be handy
for bug diagnostic. The test could be included as a unit test to
be run on make check.

The setup function will prepare a directory and kill leftover from a
previous run. The teardown function cleans up on success. The run
function is expected to be provided by the calling script and can make
use of the run_mon function to mkfs + run a monitor.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: test for MForward messages

Creates two mons, send a mon command to the peon and check that the
command is forwarded to the leader.

Add a test to check that the connection features of the client are
preserved when the message reaches the leader.

Signed-off-by: Loic Dachary <loic@dachary.org>