From 7d90cb12b859a0fc0e6a0300711e55b5c88c9e5b Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Fri, 5 Jun 2015 16:12:38 +0100 Subject: [PATCH] mon: Monitor: add admin socket command 'ops' Dumps currently in-flight ops in the monitor Signed-off-by: Joao Eduardo Luis --- src/mon/Monitor.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index e716ea4edb556..fc6ce68a5134f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -295,8 +295,9 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format, args = "[" + args + "]"; bool read_only = (command == "mon_status" || - command == "mon metadata" || - command == "quorum_status"); + command == "mon metadata" || + command == "quorum_status" || + command == "ops"); (read_only ? audit_clog->debug() : audit_clog->info()) << "from='admin socket' entity='admin socket' " @@ -329,6 +330,11 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format, start_election(); elector.stop_participating(); ss << "stopped responding to quorum, initiated new election"; + } else if (command == "ops") { + op_tracker.dump_ops_in_flight(f.get()); + if (f) { + f->flush(ss); + } } else { assert(0 == "bad AdminSocket command binding"); } @@ -729,6 +735,11 @@ int Monitor::preinit() admin_hook, "force monitor out of the quorum"); assert(r == 0); + r = admin_socket->register_command("ops", + "ops", + admin_hook, + "show the ops currently in flight"); + assert(r == 0); lock.Lock(); // add ourselves as a conf observer @@ -847,6 +858,7 @@ void Monitor::shutdown() admin_socket->unregister_command("quorum_status"); admin_socket->unregister_command("sync_force"); admin_socket->unregister_command("add_bootstrap_peer_hint"); + admin_socket->unregister_command("ops"); delete admin_hook; admin_hook = NULL; } -- 2.39.5