From 9fcc7e0d8bb3c6fbd5d1ee3c83a5372dafac2587 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 19 Nov 2019 10:55:22 +0800 Subject: [PATCH] mon: refuse to execute obsoleted tell commands we need to stop executing obsoleted tell commands. it helps us to deprecate and remove unsupported command over time. Signed-off-by: Kefu Chai --- src/mon/Monitor.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 5baa2c9b551..f34cc1c55c8 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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, -- 2.39.5