From e07a84a01fb4b335d569b5e8e7e0287201a1a58e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 19 Jul 2017 16:58:14 -0400 Subject: [PATCH] mon: restore mgr command lookup so that we can still proxy to mgr Since mgr commands aren't in the main mon_commands array now, we need to explicitly look up commands there too. This restores the behavior implemented below in which we forward misdirected mgr commands to the mon. Signed-off-by: Sage Weil --- src/mon/Monitor.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 86cfa91e6b3..7969df17f57 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3012,17 +3012,26 @@ void Monitor::handle_command(MonOpRequestRef op) // validate command is in leader map const MonCommand *leader_cmd; + const auto& mgr_cmds = mgrmon()->get_command_descs(); + const MonCommand *mgr_cmd = _get_moncommand(prefix, &mgr_cmds.at(0), + mgr_cmds.size()); leader_cmd = _get_moncommand(prefix, // the boost underlying this isn't const for some reason const_cast(leader_supported_mon_commands), leader_supported_mon_commands_size); if (!leader_cmd) { - reply_command(op, -EINVAL, "command not known", 0); - return; + leader_cmd = mgr_cmd; + if (!leader_cmd) { + reply_command(op, -EINVAL, "command not known", 0); + return; + } } // validate command is in our map & matches, or forward if it is allowed const MonCommand *mon_cmd = _get_moncommand(prefix, mon_commands, ARRAY_SIZE(mon_commands)); + if (!mon_cmd) { + mon_cmd = mgr_cmd; + } if (!is_leader()) { if (!mon_cmd) { if (leader_cmd->is_noforward()) { -- 2.39.5