From: Adam King Date: Tue, 17 May 2022 00:44:11 +0000 (-0400) Subject: mgr/cephadm: force fail over when we want to remove active mgr X-Git-Tag: v16.2.11~578^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=582499885a21bf44cfb18df262211851be2976d7;p=ceph.git mgr/cephadm: force fail over when we want to remove active mgr Fixes: https://tracker.ceph.com/issues/55679 Signed-off-by: Adam King (cherry picked from commit 63d13df4eb469fb6f5d85ee06184e7df670aa193) --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index f66612644626..4c6f50a90328 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -787,6 +787,14 @@ class CephadmServe: if daemon_place_fails: self.mgr.set_health_warning('CEPHADM_DAEMON_PLACE_FAIL', f'Failed to place {len(daemon_place_fails)} daemon(s)', len(daemon_place_fails), daemon_place_fails) + if service_type == 'mgr': + active_mgr = svc.get_active_daemon(self.mgr.cache.get_daemons_by_type('mgr')) + if active_mgr.daemon_id in [d.daemon_id for d in daemons_to_remove]: + # We can't just remove the active mgr like any other daemon. + # Need to fail over later so it can be removed on next pass. + # This can be accomplished by scheduling a restart of the active mgr. + self.mgr._schedule_daemon_action(active_mgr.name(), 'restart') + # remove any? def _ok_to_stop(remove_daemons: List[orchestrator.DaemonDescription]) -> bool: daemon_ids = [d.daemon_id for d in remove_daemons]