]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: allow deprecating commands and debugging as obsolete
authorJoao Eduardo Luis <joao@suse.de>
Fri, 8 May 2015 18:09:03 +0000 (19:09 +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/common/config_opts.h
src/mon/MonCommands.h
src/mon/Monitor.cc
src/mon/Monitor.h

index f01e5bd9eee0de0038ec3701ec70a91de507b245..c62027a8ed3ac30825bc1224e16d70ec82a0ca57 100644 (file)
@@ -257,6 +257,9 @@ OPTION(mon_osd_min_down_reports, OPT_INT, 3)     // number of times a down OSD m
 OPTION(mon_osd_force_trim_to, OPT_INT, 0)   // force mon to trim maps to this point, regardless of min_last_epoch_clean (dangerous, use with care)
 OPTION(mon_mds_force_trim_to, OPT_INT, 0)   // force mon to trim mdsmaps to this point (dangerous, use with care)
 
+// monitor debug options
+OPTION(mon_debug_deprecated_as_obsolete, OPT_BOOL, false) // consider deprecated commands as obsolete
+
 // dump transactions
 OPTION(mon_debug_dump_transactions, OPT_BOOL, false)
 OPTION(mon_debug_dump_location, OPT_STR, "/var/log/ceph/$cluster-$name.tdump")
index 126588e037f5764cda31e72300e4cefcb2e3a468..dc335f9109b3ce077daee27b149052af6889dd0e 100644 (file)
  *  NONE      - no flag assigned
  *  NOFORWARD - command may not be forwarded
  *  OBSOLETE  - command is considered obsolete
+ *  DEPRECATED - command is considered deprecated
+ *
+ * A command should always be first considered DEPRECATED before being
+ * considered OBSOLETE, giving due consideration to users and conforming
+ * to any guidelines regarding deprecating commands.
  */
 
 /*
index 9d6f1079f91b7777fa1344d9ff2e21c03802894e..ac1af1e5998f9c43b8334f2e3518947a75f3e1ff 100644 (file)
@@ -2635,7 +2635,9 @@ void Monitor::handle_command(MMonCommand *m)
     }
   }
 
-  if (mon_cmd->is_obsolete()) {
+  if (mon_cmd->is_obsolete() ||
+      (cct->_conf->mon_debug_deprecated_as_obsolete
+       && mon_cmd->is_deprecated())) {
     reply_command(m, -ENOTSUP,
                   "command is obsolete; please check usage and/or man page",
                   0);
index 879bdc00f403367f1cebec599d9ace6198b167cb..35e319cfe9eb7f9756528e52c5cabb6c916b5d90 100644 (file)
@@ -949,6 +949,7 @@ struct MonCommand {
   static const uint64_t FLAG_NONE       = 0;
   static const uint64_t FLAG_NOFORWARD  = 1 << 0;
   static const uint64_t FLAG_OBSOLETE   = 1 << 1;
+  static const uint64_t FLAG_DEPRECATED = 1 << 2;
   
   bool has_flag(uint64_t flag) const { return (flags & flag) != 0; }
   void set_flag(uint64_t flag) { flags |= flag; }
@@ -986,6 +987,11 @@ struct MonCommand {
   bool is_obsolete() const {
     return has_flag(MonCommand::FLAG_OBSOLETE);
   }
+
+  bool is_deprecated() const {
+    return has_flag(MonCommand::FLAG_DEPRECATED);
+  }
+
   static void encode_array(const MonCommand *cmds, int size, bufferlist &bl) {
     ENCODE_START(2, 1, bl);
     uint16_t s = size;