From: Sage Weil Date: Thu, 23 Feb 2017 22:18:08 +0000 (-0500) Subject: mon: hide the MGR flag on mon commands until require_luminous is set X-Git-Tag: v12.0.2~252^2~72 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f8d6af9839973959c5e9aa62484c3b9b83b806c9;p=ceph.git mon: hide the MGR flag on mon commands until require_luminous is set Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index df56bb6c08ec..1ba3c28f8c7f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2661,18 +2661,23 @@ bool Monitor::_allowed_command(MonSession *s, string &module, string &prefix, void Monitor::format_command_descriptions(const MonCommand *commands, unsigned commands_size, Formatter *f, - bufferlist *rdata) + bufferlist *rdata, + bool hide_mgr_flag) { int cmdnum = 0; f->open_object_section("command_descriptions"); for (const MonCommand *cp = commands; cp < &commands[commands_size]; cp++) { + unsigned flags = cp->flags; + if (hide_mgr_flag) { + flags &= ~MonCommand::FLAG_MGR; + } ostringstream secname; secname << "cmd" << setfill('0') << std::setw(3) << cmdnum; dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring, cp->module, - cp->req_perms, cp->availability, cp->flags); + cp->req_perms, cp->availability, flags); cmdnum++; } f->close_section(); // command_descriptions @@ -2765,8 +2770,12 @@ void Monitor::handle_command(MonOpRequestRef op) if (prefix == "get_command_descriptions") { bufferlist rdata; Formatter *f = Formatter::create("json"); + // hide mgr commands until luminous upgrade is complete + bool hide_mgr_flag = + !osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS); format_command_descriptions(leader_supported_mon_commands, - leader_supported_mon_commands_size, f, &rdata); + leader_supported_mon_commands_size, f, &rdata, + hide_mgr_flag); delete f; reply_command(op, 0, "", rdata, 0); return; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 140117e10014..39eff4bd3040 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -949,7 +949,8 @@ public: static void format_command_descriptions(const MonCommand *commands, unsigned commands_size, Formatter *f, - bufferlist *rdata); + bufferlist *rdata, + bool hide_mgr_flag=false); void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count); /// the Monitor owns this pointer once you pass it in void set_leader_supported_commands(const MonCommand *cmds, int size);