]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/MgrStandby: respawn if mgr_standby_modules changes
authorSage Weil <sage@newdream.net>
Fri, 16 Apr 2021 16:12:01 +0000 (12:12 -0400)
committerSage Weil <sage@newdream.net>
Tue, 4 May 2021 16:16:12 +0000 (11:16 -0500)
If we have standby modules and this goes false, or do not have modules
and this goes true, then respawn.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit efc29fb3630aaab4e04d99621c40561d38a99c03)

src/mgr/MgrStandby.cc
src/mgr/PyModuleRegistry.h

index fdb55c52027c8b624a279229cfea9f97cbb87f80..ef977e0c80b5fb95b008ac2b0bfb4a714b032049 100644 (file)
@@ -74,6 +74,7 @@ const char** MgrStandby::get_tracked_conf_keys() const
     "clog_to_graylog",
     "clog_to_graylog_host",
     "clog_to_graylog_port",
+    "mgr_standby_modules",
     "host",
     "fsid",
     NULL
@@ -96,6 +97,17 @@ void MgrStandby::handle_conf_change(
       changed.count("fsid")) {
     _update_log_config();
   }
+  if (changed.count("mgr_standby_modules") && !active_mgr) {
+    if (g_conf().get_val<bool>("mgr_standby_modules") != py_module_registry.have_standby_modules()) {
+      dout(1) << "mgr_standby_modules now "
+             << (int)g_conf().get_val<bool>("mgr_standby_modules")
+             << ", standby modules are "
+             << (py_module_registry.have_standby_modules() ? "":"not ")
+             << "active, respawning"
+             << dendl;
+      respawn();
+    }
+  }
 }
 
 int MgrStandby::init()
index a5f38e8f65a2729f82d49ce06d690c8c281b2434..ad48af9dafea64d5df4ecc530b48b9754b7e5e5e 100644 (file)
@@ -98,6 +98,10 @@ public:
    */
   bool handle_mgr_map(const MgrMap &mgr_map_);
 
+  bool have_standby_modules() const {
+    return !!standby_modules;
+  }
+
   void init();
 
   void upgrade_config(