From: jianglong01 Date: Fri, 23 Apr 2021 10:10:30 +0000 (+0800) Subject: mgr/cephadm: The command of 'ceph orch daemon restart mgr.xxx' may case mgr daemon... X-Git-Tag: v17.1.0~2132^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41002%2Fhead;p=ceph.git mgr/cephadm: The command of 'ceph orch daemon restart mgr.xxx' may case mgr daemon loop to restart Scene: The mgr daemon is active. After execing restart command, it may be save "scheduled_daemon_actions": {"mgr.xxx": "restart"}}" to config-key. So the mgr daemon will restart before call rm_scheduled_daemon_action which case mgr daemon will load restart forever. Fix mgr infinite restart issue refering to the same solution as 'ceph orch daemon redeploy'. Signed-off-by: jianglong01 --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 6acfaa2d3039..68b501a2c76c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1691,8 +1691,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, self._daemon_action_set_image(action, image, daemon_spec.daemon_type, daemon_spec.daemon_id) - if action == 'redeploy' and self.daemon_is_self(daemon_spec.daemon_type, - daemon_spec.daemon_id): + if (action == 'redeploy' or action == 'restart') and self.daemon_is_self(daemon_spec.daemon_type, + daemon_spec.daemon_id): self.mgr_service.fail_over() return '' # unreachable @@ -1743,7 +1743,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, assert d.daemon_type is not None assert d.daemon_id is not None - if action == 'redeploy' and self.daemon_is_self(d.daemon_type, d.daemon_id) \ + if (action == 'redeploy' or action == 'restart') and self.daemon_is_self(d.daemon_type, d.daemon_id) \ and not self.mgr_service.mgr_map_has_standby(): raise OrchestratorError( f'Unable to schedule redeploy for {daemon_name}: No standby MGRs') @@ -1766,7 +1766,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, assert dd.daemon_type is not None assert dd.daemon_id is not None assert dd.hostname is not None - if action == 'redeploy' and self.daemon_is_self(dd.daemon_type, dd.daemon_id) \ + if (action == 'redeploy' or action == 'restart') and self.daemon_is_self(dd.daemon_type, dd.daemon_id) \ and not self.mgr_service.mgr_map_has_standby(): raise OrchestratorError( f'Unable to schedule redeploy for {daemon_name}: No standby MGRs')