]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: hide the MGR flag on mon commands until require_luminous is set
authorSage Weil <sage@redhat.com>
Thu, 23 Feb 2017 22:18:08 +0000 (17:18 -0500)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 15:38:31 +0000 (11:38 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index df56bb6c08ec30a41ef42b6df0e17ba951510849..1ba3c28f8c7f39ede974e469a10c5ca2faef4ea6 100644 (file)
@@ -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;
index 140117e100140be77de550b731ddaa5a567f9b6a..39eff4bd30405d0af1c64912eed898cd72b41c44 100644 (file)
@@ -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);