Skip to content

Commit 296821e

Browse files
authored
Merge pull request ceph#62745 from VallariAg/fix-2279225
mgr/cephadm/module.py: Run ok_to_stop logic for stop
2 parents 56d7e88 + d678644 commit 296821e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/pybind/mgr/cephadm/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,7 @@ def daemon_action(self, action: str, daemon_name: str, image: Optional[str] = No
26672667
raise OrchestratorError(
26682668
f'Unable to schedule redeploy for {daemon_name}: No standby MGRs')
26692669

2670-
if action == 'restart' and not force:
2670+
if action in ['restart', 'stop'] and not force:
26712671
r = service_registry.get_service(daemon_type_to_service(
26722672
d.daemon_type)).ok_to_stop([d.daemon_id], force=False)
26732673
if r.retval:

src/pybind/mgr/cephadm/tests/test_cephadm.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,20 @@ def test_daemon_action(self, cephadm_module: CephadmOrchestrator):
394394
assert wait(cephadm_module,
395395
c) == f"Scheduled to redeploy rgw.{daemon_id} on host 'test'"
396396

397-
for what in ('start', 'stop'):
398-
c = cephadm_module.daemon_action(what, d_name)
399-
assert wait(cephadm_module,
400-
c) == F"Scheduled to {what} {d_name} on host 'test'"
397+
c = cephadm_module.daemon_action('start', d_name)
398+
assert wait(cephadm_module,
399+
c) == F"Scheduled to start {d_name} on host 'test'"
401400

402401
for what in ('start', 'stop', 'restart'):
403402
c = cephadm_module.daemon_action(what, d_name, force=True)
404403
assert wait(cephadm_module,
405404
c) == F"Scheduled to {what} {d_name} on host 'test'"
406405

407-
with pytest.raises(OrchestratorError, match=f"Unable to restart daemon {d_name}"):
408-
c = cephadm_module.daemon_action('restart', d_name)
409-
wait(cephadm_module, c)
406+
for what in ('stop', 'restart'):
407+
with pytest.raises(OrchestratorError, match=f"Unable to {what} daemon {d_name}"):
408+
c = cephadm_module.daemon_action(what, d_name)
409+
wait(cephadm_module, c)
410+
410411
# Make sure, _check_daemons does a redeploy due to monmap change:
411412
cephadm_module._store['_ceph_get/mon_map'] = {
412413
'modified': datetime_to_str(datetime_now()),

0 commit comments

Comments
 (0)