]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: add `post_remove` daemon action
authorMichael Fritch <mfritch@suse.com>
Fri, 11 Sep 2020 14:10:17 +0000 (08:10 -0600)
committerMichael Fritch <mfritch@suse.com>
Fri, 11 Sep 2020 14:10:17 +0000 (08:10 -0600)
invoked after a daemon has been removed

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/cephadmservice.py

index bf37872f55e3b8cf7b2f83916694c6f2792e1b84..d188637baa425629990d6f54ac34f1a177a5daf0 100644 (file)
@@ -2055,6 +2055,9 @@ To check that the host is reachable:
                 # remove item from cache
                 self.cache.rm_daemon(host, name)
             self.cache.invalidate_host_daemons(host)
+
+            self.cephadm_services[daemon_type].post_remove(daemon_id)
+
             return "Removed {} from host '{}'".format(name, host)
 
     def _config_fn(self, service_type) -> Optional[Callable[[ServiceSpec], None]]:
index 648ca1c931e7a91018ebce8a56630d80929523e0..73b7c88d3c5c4bbfe2c6c9d22045d1aab28b2095 100644 (file)
@@ -216,7 +216,13 @@ class CephadmService(metaclass=ABCMeta):
         """
         Called before the daemon is removed.
         """
-        pass
+        logger.debug(f'Pre remove daemon {self.TYPE}.{daemon_id}')
+
+    def post_remove(self, daemon_id: str) -> None:
+        """
+        Called after the daemon is removed.
+        """
+        logger.debug(f'Post remove daemon {self.TYPE}.{daemon_id}')
 
 
 class CephService(CephadmService):
@@ -354,6 +360,7 @@ class MonService(CephService):
             'Removing %s would break mon quorum (new quorum %s, new mons %s)' % (mon_id, new_quorum, new_mons))
 
     def pre_remove(self, daemon_id: str) -> None:
+        super().pre_remove(daemon_id)
         self._check_safe_to_destroy(daemon_id)
 
         # remove mon from quorum before we destroy the daemon