From 75c7ee239b79aeab2c1f42d4373a4d36486ffc02 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 27 Aug 2019 12:08:45 +0800 Subject: [PATCH] mgr/MgrMonitor: print pending.always_on_modules before updating it * early return to reduce the indent level for improve the readability * print out the full `pending.always_on_modules` instead of the modules for current release, as we change it as long as the `map` does not match the one shipped in monitor, even if the discrepancy has no effects on current release. * print `pending.always_on_modules` before updating it, to fix the logging message Signed-off-by: Kefu Chai --- src/mon/MgrMonitor.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index e92fe529926..eabae5a11c5 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -664,18 +664,21 @@ void MgrMonitor::cancel_timer() void MgrMonitor::on_active() { - if (mon->is_leader()) { - mon->clog->debug() << "mgrmap e" << map.epoch << ": " << map; - - if (HAVE_FEATURE(mon->get_quorum_con_features(), SERVER_NAUTILUS) && - pending_map.always_on_modules != always_on_modules) { - pending_map.always_on_modules = always_on_modules; - dout(4) << "always on modules changed, pending " - << pending_map.get_always_on_modules() - << " != wanted " << always_on_modules << dendl; - propose_pending(); - } + if (!mon->is_leader()) { + return; + } + mon->clog->debug() << "mgrmap e" << map.epoch << ": " << map; + if (!HAVE_FEATURE(mon->get_quorum_con_features(), SERVER_NAUTILUS)) { + return; } + if (pending_map.always_on_modules == always_on_modules) { + return; + } + dout(4) << "always on modules changed, pending " + << pending_map.always_on_modules << " != wanted " + << always_on_modules << dendl; + pending_map.always_on_modules = always_on_modules; + propose_pending(); } void MgrMonitor::tick() -- 2.39.5