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 <jianglong01@qianxin.com>
This commit is contained in:
jianglong01 2021-04-23 18:10:30 +08:00
parent 9cd823a81c
commit cc5b77ee87

View File

@ -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')