]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: remove orphan daemons
authorSage Weil <sage@redhat.com>
Mon, 9 Mar 2020 18:36:59 +0000 (13:36 -0500)
committerSage Weil <sage@redhat.com>
Tue, 10 Mar 2020 13:43:05 +0000 (08:43 -0500)
...as long as they're not mon|mgr|osd.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index daadd4bff1e8f6f6896746bacc2cfbf2d67c62df..e5e203c07e73b221c86489635f6c544d609e9450 100644 (file)
@@ -1079,7 +1079,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
             if self._apply_all_services():
                 continue  # did something, refresh
 
-            self._refresh_configs()
+            self._check_daemons()
 
             if self.upgrade_state and not self.upgrade_state.get('paused'):
                 self._do_upgrade()
@@ -2261,10 +2261,19 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
                     spec.service_name(), spec, e))
         return r
 
-    def _refresh_configs(self):
+    def _check_daemons(self):
         daemons = self.cache.get_daemons()
         grafanas = []  # type: List[orchestrator.DaemonDescription]
         for dd in daemons:
+            # orphan?
+            if dd.service_name() not in self.spec_store.specs and \
+               dd.daemon_type not in ['mon', 'mgr', 'osd']:
+                # (mon and mgr specs should always exist; osds aren't matched
+                # to a service spec)
+                self.log.info('Removing orphan daemon %s...' % dd.name())
+                self._remove_daemon(dd.name(), dd.hostname, True)
+
+            # dependencies?
             if dd.daemon_type == 'grafana':
                 # put running instances at the front of the list
                 grafanas.insert(0, dd)