From: Sage Weil Date: Mon, 9 Mar 2020 18:36:59 +0000 (-0500) Subject: mgr/cephadm: remove orphan daemons X-Git-Tag: v15.1.1~37^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=333752cf0fe2f38bccd6bb0b90e2227324e7fc8f;p=ceph.git mgr/cephadm: remove orphan daemons ...as long as they're not mon|mgr|osd. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index daadd4bff1e..e5e203c07e7 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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)