Skip to content

Commit 4b343d6

Browse files
authored
Merge pull request ceph#48517 from adk3798/active-mgr-redeploy
mgr/cephadm: save host cache data after scheduling daemon action Reviewed-by: Michael Fritch <[email protected]>
2 parents b460d28 + 2ff3ae7 commit 4b343d6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/pybind/mgr/cephadm/module.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,7 @@ def _schedule_daemon_action(self, daemon_name: str, action: str) -> str:
21482148
raise OrchestratorError(
21492149
f'Unable to schedule redeploy for {daemon_name}: No standby MGRs')
21502150
self.cache.schedule_daemon_action(dd.hostname, dd.name(), action)
2151+
self.cache.save_host(dd.hostname)
21512152
msg = "Scheduled to {} {} on host '{}'".format(action, daemon_name, dd.hostname)
21522153
self._kick_serve_loop()
21532154
return msg

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ def test_daemon_action_fail(self, cephadm_module: CephadmOrchestrator):
404404
]
405405
)
406406
@mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
407-
def test_daemon_check(self, cephadm_module: CephadmOrchestrator, action):
407+
@mock.patch("cephadm.module.HostCache.save_host")
408+
def test_daemon_check(self, _save_host, cephadm_module: CephadmOrchestrator, action):
408409
with with_host(cephadm_module, 'test'):
409410
with with_service(cephadm_module, ServiceSpec(service_type='grafana'), CephadmOrchestrator.apply_grafana, 'test') as d_names:
410411
[daemon_name] = d_names
@@ -416,6 +417,7 @@ def test_daemon_check(self, cephadm_module: CephadmOrchestrator, action):
416417

417418
CephadmServe(cephadm_module)._check_daemons()
418419

420+
assert _save_host.called_with('test')
419421
assert cephadm_module.cache.get_scheduled_daemon_action('test', daemon_name) is None
420422

421423
@mock.patch("cephadm.serve.CephadmServe._run_cephadm")

0 commit comments

Comments
 (0)