]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: omit deprecated commands in desc
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 11 Oct 2016 17:53:16 +0000 (13:53 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 12 Oct 2016 13:45:21 +0000 (09:45 -0400)
This is useful for filtering out deprecated commands in help output. For
example, `ceph mds -h` no longer lists commands like `mds set_max_mds`.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/ceph.in
src/common/cmdparse.cc
src/common/cmdparse.h
src/mds/MDSDaemon.cc
src/mgr/DaemonServer.cc
src/mon/Monitor.cc
src/osd/OSD.cc

index 5ea0876d7f07e2f851d87fb0d3589b9e8ccca269..a32d42c8e9ce07cfd7fdfa6a31f06e15b1d343a6 100755 (executable)
@@ -33,6 +33,11 @@ except NameError:
 CEPH_GIT_VER="@CEPH_GIT_VER@"
 CEPH_GIT_NICE_VER="@CEPH_GIT_NICE_VER@"
 
+# Flags from src/mon/Monitor.h
+FLAG_NOFORWARD  = (1 << 0)
+FLAG_OBSOLETE   = (1 << 1)
+FLAG_DEPRECATED = (1 << 2)
+
 # Make life easier on developers:
 # If in src/, and .libs and pybind exist here, assume we're running
 # from a Ceph source dir and tweak PYTHONPATH and LD_LIBRARY_PATH
@@ -337,6 +342,8 @@ def format_help(cmddict, partial=None):
 
         if not cmd['help']:
             continue
+        if cmd['flags'] is not None and ((cmd['flags'] & (FLAG_OBSOLETE | FLAG_DEPRECATED)) != 0):
+            continue
         concise = concise_sig(cmd['sig'])
         if partial and not concise.startswith(partial):
             continue
index ea8b8fe5ce637a6135ed2b385e311ba0c338e02c..51e67e389964c0a4e9dd46d5366d3599de087619 100644 (file)
@@ -123,7 +123,8 @@ dump_cmddesc_to_json(Formatter *jf,
                     const string& helptext,
                     const string& module,
                     const string& perm,
-                    const string& avail)
+                    const string& avail,
+                    uint64_t flags)
 {
       jf->open_object_section(secname.c_str());
       jf->open_array_section("sig");
@@ -133,10 +134,10 @@ dump_cmddesc_to_json(Formatter *jf,
       jf->dump_string("module", module.c_str());
       jf->dump_string("perm", perm.c_str());
       jf->dump_string("avail", avail.c_str());
+      jf->dump_int("flags", flags);
       jf->close_section(); // cmd
 }
 
-
 void cmdmap_dump(const cmdmap_t &cmdmap, Formatter *f)
 {
   assert(f != nullptr);
index b13bfbde7b6f1fa03160b4d87ee931c68b27640e..104848dc263485143a7532bb032b2038335b3e78 100644 (file)
@@ -37,7 +37,8 @@ void dump_cmddesc_to_json(ceph::Formatter *jf,
                          const std::string& helptext,
                          const std::string& module,
                          const std::string& perm,
-                         const std::string& avail);
+                         const std::string& avail,
+                         uint64_t flags);
 bool cmdmap_from_json(std::vector<std::string> cmd, cmdmap_t *mapp,
                      std::stringstream &ss);
 void cmdmap_dump(const cmdmap_t &cmdmap, ceph::Formatter *f);
index e539fc57eb969177314e24a6e739dd35ca3ba1d4..07701ddf59bbbce673d30f516f202ce7dc9f79aa 100644 (file)
@@ -760,7 +760,7 @@ int MDSDaemon::_handle_command(
       ostringstream secname;
       secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
       dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring,
-                          cp->module, cp->perm, cp->availability);
+                          cp->module, cp->perm, cp->availability, 0);
       cmdnum++;
     }
     f->close_section();        // command_descriptions
index 31f0ce999d396e31414a2b3329210a751e75bb8e..53740868dc5d1768cda1ffb79fbf8625247636e3 100644 (file)
@@ -263,7 +263,7 @@ bool DaemonServer::handle_command(MCommand *m)
       dout(20) << "Dumping " << pyc.cmdstring << " (" << pyc.helpstring
                << ")" << dendl;
       dump_cmddesc_to_json(&f, secname.str(), pyc.cmdstring, pyc.helpstring,
-                          "mgr", pyc.perm, "cli");
+                          "mgr", pyc.perm, "cli", 0);
       cmdnum++;
     }
 #if 0
@@ -273,7 +273,7 @@ bool DaemonServer::handle_command(MCommand *m)
       ostringstream secname;
       secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
       dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring,
-                          cp->module, cp->perm, cp->availability);
+                          cp->module, cp->perm, cp->availability, 0);
       cmdnum++;
     }
 #endif
index 4a0c1ac3dfaf31af9da59e7fd122193a9b3e3596..6a056c5104fcb388323ef614c3b94a1a6a37e2af 100644 (file)
@@ -2559,7 +2559,7 @@ void Monitor::format_command_descriptions(const MonCommand *commands,
     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->req_perms, cp->availability, cp->flags);
     cmdnum++;
   }
   f->close_section();  // command_descriptions
index bcdce403ac2d43c323e9959c973ad6b5f014a02b..af3436e051f4232a6ec9af49dfb8312da82a27e6 100644 (file)
@@ -5466,7 +5466,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
       ostringstream secname;
       secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
       dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring,
-                          cp->module, cp->perm, cp->availability);
+                          cp->module, cp->perm, cp->availability, 0);
       cmdnum++;
     }
     f->close_section();        // command_descriptions