]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: restore mgr command lookup so that we can still proxy to mgr
authorSage Weil <sage@redhat.com>
Wed, 19 Jul 2017 20:58:14 +0000 (16:58 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 19 Jul 2017 21:21:24 +0000 (17:21 -0400)
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 <sage@redhat.com>
src/mon/Monitor.cc

index 86cfa91e6b3845ed1322974a5bfb1d4a2b3f5415..7969df17f57d4cb80148088f9db76fc612b70f45 100644 (file)
@@ -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<MonCommand*>(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()) {