From: John Spray Date: Thu, 27 Jul 2017 15:49:45 +0000 (-0400) Subject: mon/MgrMonitor: store services in map and expose with command X-Git-Tag: v13.0.1~332^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3c3e4e90ba6b09e29879b500f211d607ebabb53;p=ceph.git mon/MgrMonitor: store services in map and expose with command Signed-off-by: John Spray --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 9a340d950eff..a1a2b2b94fd6 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -302,6 +302,13 @@ bool MgrMonitor::prepare_beacon(MonOpRequestRef op) bool updated = false; if (pending_map.active_gid == m->get_gid()) { + if (pending_map.services != m->get_services()) { + dout(4) << "updated services from mgr." << m->get_name() + << ": " << m->get_services() << dendl; + pending_map.services = m->get_services(); + updated = true; + } + // A beacon from the currently active daemon if (pending_map.active_addr != m->get_server_addr()) { dout(4) << "learned address " << m->get_server_addr() @@ -695,6 +702,13 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op) } f->close_section(); f->flush(rdata); + } else if (prefix == "mgr services") { + f->open_object_section("services"); + for (const auto &i : map.services) { + f->dump_string(i.first.c_str(), i.second); + } + f->close_section(); + f->flush(rdata); } else if (prefix == "mgr metadata") { string name; cmd_getval(g_ceph_context, cmdmap, "id", name); diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 40c843ef6412..4694c1102b46 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -1064,6 +1064,9 @@ COMMAND("mgr fail name=who,type=CephString", \ "treat the named manager daemon as failed", "mgr", "rw", "cli,rest") COMMAND("mgr module ls", "list active mgr modules", "mgr", "r", "cli,rest") +COMMAND("mgr services", + "list service endpoints provided by mgr modules", + "mgr", "r", "cli,rest") COMMAND("mgr module enable " \ "name=module,type=CephString " \ "name=force,type=CephChoices,strings=--force,req=false",