From: Joao Eduardo Luis Date: Fri, 8 May 2015 18:09:03 +0000 (+0100) Subject: mon: Monitor: allow deprecating commands and debugging as obsolete X-Git-Tag: v9.0.3~21^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d9acd68caea4462cfc0f6d6b3bb47d0d937b48c7;p=ceph.git mon: Monitor: allow deprecating commands and debugging as obsolete Signed-off-by: Joao Eduardo Luis --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index f01e5bd9eee..c62027a8ed3 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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") diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 126588e037f..dc335f9109b 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -110,6 +110,11 @@ * 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. */ /* diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 9d6f1079f91..ac1af1e5998 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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); diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 879bdc00f40..35e319cfe9e 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -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;