mon: split prepare_command in two

So that it is possible to call prepare_command without a session
established and a cmdmap that has already been parsed.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: Monitor::send_reply gracefully handles no connection

If req->get_connection() returns a null pointer, drop the reply instead
of crashing the monitor.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add --mon-advanced-debug-mode

When this flag is true, the mon is expected to provide functionalities
that are for developer oriented debug purposes only. It is meant to
be used by the developer and not the system administrator, because it
would allow a non-developer to break things in ways that would be very
difficult to diagnose. It should probably not be documented.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: add osdmonitor_prepare_command to the admin socket

It provides a developer path allowing functional tests to modify the
pending OSDMap without triggering a PaxosProposal.

It can be used as follows:

   echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush tunables","profile":"bobtail"}' | nc -U out/mon.a.asok

It will transform the command into:

  {"prefix":"osd crush tunables","profile":"bobtail"}

and feed it to OSDMonitor::prepare_command_impl(). The pending OSDMap won't
be proposed because it short circuit PaxosService::dispatch. It will,
however, be proposed next time PaxosService::dispatch() gets a chance.

It cannot be used via the ceph command line.

Signed-off-by: Loic Dachary <loic@dachary.org>
mon: remove racy tests from osd-pool-create.sh

Use the admin socket to create the conditions by which a pool creation
is made to wait for the next paxos proposal because the required crush
ruleset is pending.

It replaces a fragile time sensitive workaround that could fail because
of race conditions. It also has the benefit of increase the speed of the
test because there is no need to wait for a long time just to accomodate
the slowest machines.

Signed-off-by: Loic Dachary <loic@dachary.org>
Merge pull request #1222 from dachary/wip-pending-osdmap

mon: control pending OSDMap for testing

Reviewed-by: Joao Eduardo Luis <joao@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>