]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: save host cache data after scheduling daemon action 48517/head
authorAdam King <adking@redhat.com>
Mon, 17 Oct 2022 18:56:34 +0000 (14:56 -0400)
committerAdam King <adking@redhat.com>
Tue, 18 Oct 2022 14:26:45 +0000 (10:26 -0400)
Otherwise, the actions could be lost on a mgr failover
despite us including shceduled actions as part of the data
we store in the config-key entry for the host.

This also makes it impossible to redeploy the active mgr
with a new image in one command.

Fixes: https://tracker.ceph.com/issues/57884
Signed-off-by: Adam King <adking@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index a226e808502cde4c5b913dc3bec8d492463cd432..28f267bd1e5237203bb7a4f847aa19ba96c9003d 100644 (file)
@@ -2148,6 +2148,7 @@ Then run the following:
             raise OrchestratorError(
                 f'Unable to schedule redeploy for {daemon_name}: No standby MGRs')
         self.cache.schedule_daemon_action(dd.hostname, dd.name(), action)
+        self.cache.save_host(dd.hostname)
         msg = "Scheduled to {} {} on host '{}'".format(action, daemon_name, dd.hostname)
         self._kick_serve_loop()
         return msg
index 76a1073fc4aa88c480e967361cf0ff6bf2bd3a55..942448bc7563b407ad1c85953f6fa4a9beff1825 100644 (file)
@@ -404,7 +404,8 @@ class TestCephadm(object):
         ]
     )
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
-    def test_daemon_check(self, cephadm_module: CephadmOrchestrator, action):
+    @mock.patch("cephadm.module.HostCache.save_host")
+    def test_daemon_check(self, _save_host, cephadm_module: CephadmOrchestrator, action):
         with with_host(cephadm_module, 'test'):
             with with_service(cephadm_module, ServiceSpec(service_type='grafana'), CephadmOrchestrator.apply_grafana, 'test') as d_names:
                 [daemon_name] = d_names
@@ -416,6 +417,7 @@ class TestCephadm(object):
 
                 CephadmServe(cephadm_module)._check_daemons()
 
+                assert _save_host.called_with('test')
                 assert cephadm_module.cache.get_scheduled_daemon_action('test', daemon_name) is None
 
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm")