From 1f8965f8cc48c9e901f3531259d446e3d9211135 Mon Sep 17 00:00:00 2001 From: Joshua Schmid Date: Wed, 12 Aug 2020 12:23:59 +0200 Subject: [PATCH] mgr/cephadm: add by_type daemon retrieval method Signed-off-by: Joshua Schmid --- src/pybind/mgr/cephadm/inventory.py | 9 +++++++++ src/pybind/mgr/cephadm/module.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 323ba5d11d2..4b0154e75a5 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 0b3f2fd8204..cbbdb5d819a 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: -- 2.47.3