]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonCommands: add HIDDEN flag
authorSage Weil <sage@redhat.com>
Tue, 26 Jun 2018 12:03:29 +0000 (07:03 -0500)
committerSage Weil <sage@redhat.com>
Wed, 1 Aug 2018 13:12:15 +0000 (08:12 -0500)
Hide a command from the CLI and help.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonCommand.h
src/mon/MonCommands.h
src/mon/Monitor.cc

index d4869c56201c3e4f3ef8de924a0202034da6a082..50ccf2f26503f2a011f2386b7389af38f15026ea 100644 (file)
@@ -31,6 +31,7 @@ struct MonCommand {
   static const uint64_t FLAG_DEPRECATED = 1 << 2;
   static const uint64_t FLAG_MGR        = 1 << 3;
   static const uint64_t FLAG_POLL       = 1 << 4;
+  static const uint64_t FLAG_HIDDEN     = 1 << 5;
 
   bool has_flag(uint64_t flag) const { return (flags & flag) != 0; }
   void set_flag(uint64_t flag) { flags |= flag; }
@@ -91,6 +92,10 @@ struct MonCommand {
     return has_flag(MonCommand::FLAG_MGR);
   }
 
+  bool is_hidden() const {
+    return has_flag(MonCommand::FLAG_HIDDEN);
+  }
+
   static void encode_array(const MonCommand *cmds, int size, bufferlist &bl) {
     ENCODE_START(2, 1, bl);
     uint16_t s = size;
index 56626085ec267c21c6fefad71634264245c1de8a..106d973695db2445bbc9a0be556875684db4034b 100644 (file)
  *  MGR       - command goes to ceph-mgr (for luminous+)
  *  POLL      - command is intended to be called periodically by the
  *              client (see iostat)
+ *  HIDDEN    - command is hidden (no reported by help etc)
  *
  * A command should always be first considered DEPRECATED before being
  * considered OBSOLETE, giving due consideration to users and conforming
index dd9d11ee8f5d20ba90b9abb2b870897bf0f06ec2..0d78814e63200e8419b2acc97f62342b4f1b5298 100644 (file)
@@ -2977,7 +2977,9 @@ void Monitor::handle_command(MonOpRequestRef op)
         paxos_service[PAXOS_MGR].get())->get_command_descs();
 
     for (auto& c : leader_mon_commands) {
-      commands.push_back(c);
+      if (!c.is_hidden()) {
+       commands.push_back(c);
+      }
     }
 
     format_command_descriptions(commands, f, &rdata);