]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: refuse to execute obsoleted tell commands
authorKefu Chai <kchai@redhat.com>
Tue, 19 Nov 2019 02:55:22 +0000 (10:55 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 20 Dec 2019 07:56:04 +0000 (15:56 +0800)
we need to stop executing obsoleted tell commands. it helps us to
deprecate and remove unsupported command over time.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/Monitor.cc

index 5baa2c9b5517aee6a50beab7e2fe8caf915d12ec..f34cc1c55c8ebb78b1c37ad25ac5df0e1ed70843 100644 (file)
@@ -3190,6 +3190,17 @@ void Monitor::handle_tell_command(MonOpRequestRef op)
   if (!cmd_getval(g_ceph_context, cmdmap, "prefix", prefix)) {
     return reply_tell_command(op, -EINVAL, "no prefix");
   }
+  if (auto cmd = _get_moncommand(prefix,
+                                get_local_commands(quorum_mon_features));
+      cmd) {
+    if (cmd->is_obsolete() ||
+       (cct->_conf->mon_debug_deprecated_as_obsolete &&
+        cmd->is_deprecated())) {
+      return reply_tell_command(op, -ENOTSUP,
+                               "command is obsolete; "
+                               "please check usage and/or man page");
+    }
+  }
   // see if command is whitelisted
   if (!session->caps.is_capable(
       g_ceph_context,