From: Sage Weil Date: Fri, 14 Feb 2020 17:13:03 +0000 (-0600) Subject: mgr/cephadm: move _get_daemons() impl into list_daemons X-Git-Tag: v15.1.1~368^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=47b3a64ed4992186a4f496a2c0d68c9dbbb5838b;p=ceph.git mgr/cephadm: move _get_daemons() impl into list_daemons Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index c11a9c4ffc0d..04f6e414abe2 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1302,32 +1302,6 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): } return host, dm - def _get_daemons(self, - daemon_type=None, - daemon_id=None, - service_name=None, - want_host=None, - refresh=False): - if refresh: - ######### FIXME ######### - raise NotImplementedError() - result = [] - self.log.debug('_get_daemons') - for host, info in self.daemon_cache.items(): - self.log.debug('_get_daemons info %s' % info) - if want_host and host != want_host: - continue - for name, dd in info.get('daemons', {}).items(): - if daemon_type and daemon_type != dd.daemon_type: - continue - if daemon_id and daemon_id != dd.daemon_id: - continue - if service_name and not dd.name().startswith(service_name + '.'): - continue - result.append(dd) - self.log.debug('_get_daemons returns %s' % result) - return trivial_result(result) - # def describe_service(self, service_type=None, service_id=None, # node_name=None, refresh=False): # if service_type not in ("mds", "osd", "mgr", "mon", 'rgw', "nfs", None): @@ -1341,11 +1315,20 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): def list_daemons(self, daemon_type=None, daemon_id=None, host=None, refresh=False): - result = self._get_daemons(daemon_type=daemon_type, - daemon_id=daemon_id, - want_host=host, - refresh=refresh) - return result + if refresh: + ######### FIXME ######### + raise NotImplementedError() + result = [] + for h, di in self.daemon_cache.items(): + if host and h != host: + continue + for name, dd in di['daemons'].items(): + if daemon_type and daemon_type != dd.daemon_type: + continue + if daemon_id and daemon_id != dd.daemon_id: + continue + result.append(dd) + return trivial_result(result) def service_action(self, action, service_type, service_name): self.log.debug('service_action action %s type %s name %s' % (