From: Sage Weil Date: Wed, 24 Nov 2021 00:32:26 +0000 (-0500) Subject: mgr/cephadm: record when finished with scheduled daemon action X-Git-Tag: v17.1.0~368^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44080%2Fhead;p=ceph.git mgr/cephadm: record when finished with scheduled daemon action Signed-off-by: Sage Weil --- 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: