From: Joao Eduardo Luis Date: Fri, 8 Nov 2013 00:26:42 +0000 (+0000) Subject: mon: Monitor: make 'quorum enter/exit' available through the admin socket X-Git-Tag: v0.73~10^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=762acec422e8fcb2a44198e48a99294b1adbf825;p=ceph.git mon: Monitor: make 'quorum enter/exit' available through the admin socket If we don't have at least 'quorum enter' available through the admin socket, then we can never tell a monitor to go back into quorum after exiting, since it will not handle the command that forces it back in due to not being in the quorum. Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index cd541f6bf836..b35269baf15d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -258,9 +258,17 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format, return; } sync_force(f.get(), ss); - } else if (command.find("add_bootstrap_peer_hint") == 0) + } else if (command.find("add_bootstrap_peer_hint") == 0) { _add_bootstrap_peer_hint(command, cmdmap, ss); - else + } else if (command == "quorum enter") { + elector.start_participating(); + start_election(); + ss << "started responding to quorum, initiated new election"; + } else if (command == "quorum exit") { + start_election(); + elector.stop_participating(); + ss << "stopped responding to quorum, initiated new election"; + } else assert(0 == "bad AdminSocket command binding"); } @@ -504,6 +512,14 @@ int Monitor::preinit() "add peer address as potential bootstrap" " peer for cluster bringup"); assert(r == 0); + r = admin_socket->register_command("quorum enter", "quorum enter", + admin_hook, + "force monitor back into quorum"); + assert(r == 0); + r = admin_socket->register_command("quorum exit", "quorum exit", + admin_hook, + "force monitor out of the quorum"); + assert(r == 0); lock.Lock(); lock.Unlock();