From: Joshua Schmid Date: Wed, 12 Aug 2020 10:23:59 +0000 (+0200) Subject: mgr/cephadm: add by_type daemon retrieval method X-Git-Tag: v16.1.0~1404^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1f8965f8cc48c9e901f3531259d446e3d9211135;p=ceph.git mgr/cephadm: add by_type daemon retrieval method Signed-off-by: Joshua Schmid --- diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 323ba5d11d23..4b0154e75a56 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -386,6 +386,15 @@ class HostCache(): result.append(d) return result + def get_daemons_by_type(self, service_type): + # type: (str) -> List[orchestrator.DaemonDescription] + result = [] # type: List[orchestrator.DaemonDescription] + for host, dm in self.daemons.items(): + for name, d in dm.items(): + if d.daemon_type == service_type: + result.append(d) + return result + def get_daemon_names(self): # type: () -> List[str] r = [] diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 0b3f2fd8204d..cbbdb5d819aa 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2525,7 +2525,7 @@ you may want to run: process_removal_queue(). """ - daemons: List[orchestrator.DaemonDescription] = self.cache.get_daemons_by_service('osd') + daemons: List[orchestrator.DaemonDescription] = self.cache.get_daemons_by_type('osd') to_remove_daemons = list() for daemon in daemons: if daemon.daemon_id in osd_ids: