]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: add support to have OBSOLETE commands
authorJoao Eduardo Luis <joao@suse.de>
Fri, 8 May 2015 18:02:58 +0000 (19:02 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 11:20:02 +0000 (12:20 +0100)
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/MonCommands.h
src/mon/Monitor.cc
src/mon/Monitor.h

index 96b48abe1a35a3125aec7c89e54ffe3943b8c51a..126588e037f5764cda31e72300e4cefcb2e3a468 100644 (file)
  *
  *  NONE      - no flag assigned
  *  NOFORWARD - command may not be forwarded
+ *  OBSOLETE  - command is considered obsolete
  */
 
 /*
index 9bc21e946f39aa3e3d287737031fb06dc70762c9..298624e6228b588244ae528b50d24189bc8914f2 100644 (file)
@@ -2635,6 +2635,13 @@ void Monitor::handle_command(MMonCommand *m)
     }
   }
 
+  if (mon_cmd->is_obsolete()) {
+    reply_command(m, -ENOTSUP,
+                  "command is obsolete; please check usage and/or man page",
+                  0);
+    return;
+  }
+
   if (session->proxy_con && mon_cmd->has_flag(MonCommand::FLAG_NOFORWARD)) {
     dout(10) << "Got forward for noforward command " << m << dendl;
     reply_command(m, -EINVAL, "forward for noforward command", rdata, 0);
index 1dbe8c858ded609edd974eab23e8aae119a0d91c..585e8f3f1bf866f7e1bef88dc76e38f10474006c 100644 (file)
@@ -948,6 +948,7 @@ struct MonCommand {
   // MonCommand flags
   static const uint64_t FLAG_NONE       = 0;
   static const uint64_t FLAG_NOFORWARD  = 1 << 0;
+  static const uint64_t FLAG_OBSOLETE   = 1 << 1;
   
   bool has_flag(uint64_t flag) const { return (flags & flag) != 0; }
   void set_flag(uint64_t flag) { flags |= flag; }
@@ -978,6 +979,9 @@ struct MonCommand {
        availability == o->availability;
   }
 
+  bool is_obsolete() const {
+    return has_flag(MonCommand::FLAG_OBSOLETE);
+  }
   static void encode_array(const MonCommand *cmds, int size, bufferlist &bl) {
     ENCODE_START(2, 1, bl);
     uint16_t s = size;