From 4bb2566ef5ca5ac02a5e6efa301ae9aaa3a99ce1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 24 Mar 2020 21:14:43 +0800 Subject: [PATCH] mon/MgrMonitor: show different error message when disabling a dne module this is a regression introduced by a7677c76a54bdbc68ea9ba60efe7cec013d5afda per Sage, we can enable a module when the mgr is not started yet using "--force" command, but we should be allowed to disable it if the non-existent module is added. this change just changes the condition and error message so that the error message is printed if the module is not loaded at all. because the operation should be idempotent, so the operation is always finished without returning an error. Fixes: https://tracker.ceph.com/issues/44728 Signed-off-by: Kefu Chai --- src/mon/MgrMonitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index ef126edd6522..fc7d5becf022 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -1158,8 +1158,8 @@ bool MgrMonitor::prepare_command(MonOpRequestRef op) r = 0; goto out; } - if (!pending_map.any_supports_module(module)) { - ss << "module '" << module << "' does not exist"; + if (!pending_map.modules.count(module)) { + ss << "module '" << module << "' is not enabled"; } pending_map.modules.erase(module); } else { -- 2.47.3