mgr/DaemonServer: route MCommand (for octopus+) to asok commands

Send mgr 'tell' commands (if they originate from a octopus+ client that
knows the difference between MCommand and MMgrCommand) to the asok
comand queue.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-09-06 09:44:23 -05:00
parent 8128045511
commit 42823a092c

View File

@ -791,12 +791,18 @@ public:
bool DaemonServer::handle_command(const ref_t<MCommand>& m)
{
std::lock_guard l(lock);
auto cmdctx = std::make_shared<CommandContext>(m);
try {
return _handle_command(cmdctx);
} catch (const bad_cmd_get& e) {
cmdctx->reply(-EINVAL, e.what());
if (HAVE_FEATURE(m->get_connection()->get_features(), SERVER_OCTOPUS)) {
cct->get_admin_socket()->queue_tell_command(m);
return true;
} else {
// legacy client; send to CLI processing
auto cmdctx = std::make_shared<CommandContext>(m);
try {
return _handle_command(cmdctx);
} catch (const bad_cmd_get& e) {
cmdctx->reply(-EINVAL, e.what());
return true;
}
}
}