From cc5b77ee870e60c2c9d241d5826810eedb295e26 Mon Sep 17 00:00:00 2001 From: jianglong01 Date: Fri, 23 Apr 2021 18:10:30 +0800 Subject: [PATCH] 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 --- src/pybind/mgr/cephadm/module.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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') -- 2.47.3