From: Sage Weil Date: Fri, 16 Apr 2021 16:12:01 +0000 (-0400) Subject: mgr/MgrStandby: respawn if mgr_standby_modules changes X-Git-Tag: v16.2.5~39^2~4^2^2~41 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=110edcdea12cfc43194b710f4e3a6525cec54c87;p=ceph.git mgr/MgrStandby: respawn if mgr_standby_modules changes 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 (cherry picked from commit efc29fb3630aaab4e04d99621c40561d38a99c03) --- diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index fdb55c52027..ef977e0c80b 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -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("mgr_standby_modules") != py_module_registry.have_standby_modules()) { + dout(1) << "mgr_standby_modules now " + << (int)g_conf().get_val("mgr_standby_modules") + << ", standby modules are " + << (py_module_registry.have_standby_modules() ? "":"not ") + << "active, respawning" + << dendl; + respawn(); + } + } } int MgrStandby::init() diff --git a/src/mgr/PyModuleRegistry.h b/src/mgr/PyModuleRegistry.h index a5f38e8f65a..ad48af9dafe 100644 --- a/src/mgr/PyModuleRegistry.h +++ b/src/mgr/PyModuleRegistry.h @@ -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(