From 124ac26c27467e28d99e8d89ce1d7e0f1832c147 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Nov 2021 19:32:26 -0500 Subject: [PATCH] mgr/cephadm: record when finished with scheduled daemon action Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/inventory.py | 5 ++++- src/pybind/mgr/cephadm/serve.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index b5508662721a8..366b9011b9187 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -1089,12 +1089,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.') diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index f4d0b4384e6fd..e4fd8f91d972a 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -974,7 +974,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: -- 2.39.5