]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/MgrMonitor: print pending.always_on_modules before updating it
authorKefu Chai <kchai@redhat.com>
Tue, 27 Aug 2019 04:08:45 +0000 (12:08 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Aug 2019 04:14:02 +0000 (12:14 +0800)
* 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 <kchai@redhat.com>
src/mon/MgrMonitor.cc

index e92fe529926882e194891bd7bc00fd9dac40104c..eabae5a11c515d6777e9841af49b131a9ffddad5 100644 (file)
@@ -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()