From: Sage Weil Date: Thu, 31 Oct 2019 14:37:27 +0000 (-0500) Subject: mgr/ssh: make _get_services take service *id* or service *name* X-Git-Tag: v15.1.0~1055^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3acb8d9e9d7e29f6fdf1612f113a546d10046859;p=ceph-ci.git mgr/ssh: make _get_services take service *id* or service *name* Name is the group, id is the instance. A bit confusing, but this is what orchestrator.py uses. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index d5a5a5185e3..4c4d7abd54e 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -443,7 +443,10 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): nodes = [orchestrator.InventoryNode(host_name, []) for host_name in self.inventory_cache] return orchestrator.TrivialReadCompletion(nodes) - def _get_services(self, service_type=None, service_id=None, + def _get_services(self, + service_type=None, + service_name=None, + service_id=None, node_name=None): daemons = {} for host, _ in self._get_hosts(): @@ -467,11 +470,13 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): if service_type and service_type != sd.service_type: continue if '.' in d['name']: - sd.service_instance = d['name'].split('.')[1] + sd.service_instance = '.'.join(d['name'].split('.')[1:]) else: sd.service_instance = host # e.g., crash if service_id and service_id != sd.service_instance: continue + if service_name and not sd.service_instance.startswith(service_name + '-'): + continue sd.nodename = host sd.container_id = d['container_id'] sd.version = d['version'] @@ -490,7 +495,9 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): if service_type not in ("mds", "osd", "mgr", "mon", "nfs", None): raise orchestrator.OrchestratorValidationError( service_type + " unsupported") - result = self._get_services(service_type, service_id, node_name) + result = self._get_services(service_type, + service_id=service_id, + node_name=node_name) return orchestrator.TrivialReadCompletion(result) def get_inventory(self, node_filter=None, refresh=False):