]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: record when finished with scheduled daemon action
authorSage Weil <sage@newdream.net>
Wed, 24 Nov 2021 00:32:26 +0000 (19:32 -0500)
committerSebastian Wagner <sewagner@redhat.com>
Mon, 3 Jan 2022 13:59:54 +0000 (14:59 +0100)
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 124ac26c27467e28d99e8d89ce1d7e0f1832c147)

src/pybind/mgr/cephadm/inventory.py
src/pybind/mgr/cephadm/serve.py

index 85588f381f38b17114e043ab33c5b63c3a0f90c2..0d820e13d7cef571baa33fa0a1d2f005e59d623c 100644 (file)
@@ -955,12 +955,15 @@ class HostCache():
             self.scheduled_daemon_actions[host] = {}
         self.scheduled_daemon_actions[host][daemon_name] = action
 
-    def rm_scheduled_daemon_action(self, host: str, daemon_name: str) -> None:
+    def rm_scheduled_daemon_action(self, host: str, daemon_name: str) -> bool:
+        found = False
         if host in self.scheduled_daemon_actions:
             if daemon_name in self.scheduled_daemon_actions[host]:
                 del self.scheduled_daemon_actions[host][daemon_name]
+                found = True
             if not self.scheduled_daemon_actions[host]:
                 del self.scheduled_daemon_actions[host]
+        return found
 
     def get_scheduled_daemon_action(self, host: str, daemon: str) -> Optional[str]:
         assert not daemon.startswith('ha-rgw.')
index 725c39e191f0bafc35fa33e2705d636db5b3c4f6..6849fae142f01d2fb107002d345a187e84dd8f3b 100644 (file)
@@ -960,7 +960,8 @@ class CephadmServe:
                 try:
                     daemon_spec = CephadmDaemonDeploySpec.from_daemon_description(dd)
                     self.mgr._daemon_action(daemon_spec, action=action)
-                    self.mgr.cache.rm_scheduled_daemon_action(dd.hostname, dd.name())
+                    if self.mgr.cache.rm_scheduled_daemon_action(dd.hostname, dd.name()):
+                        self.mgr.cache.save_host(dd.hostname)
                 except OrchestratorError as e:
                     self.mgr.events.from_orch_error(e)
                     if dd.daemon_type in daemons_post: