From efc29fb3630aaab4e04d99621c40561d38a99c03 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 16 Apr 2021 12:12:01 -0400 Subject: [PATCH] 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 --- src/mgr/MgrStandby.cc | 12 ++++++++++++ src/mgr/PyModuleRegistry.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index ea15a1456eb5d..b78874c05ff33 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -75,6 +75,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 @@ -97,6 +98,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 a5f38e8f65a27..ad48af9dafea6 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( -- 2.39.5