From: Sebastian Wagner Date: Mon, 14 Sep 2020 09:34:32 +0000 (+0200) Subject: python-common: deprecate filter_matching_hosts X-Git-Tag: v16.1.0~1060^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b7aeafad1bb4e3f0818417008f5df616de8f90c;p=ceph.git python-common: deprecate filter_matching_hosts Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index e17394df8a84..5f449e26a3fb 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1228,9 +1228,6 @@ To check that the host is reachable: code, '\n'.join(err))) return out, err, code - def _get_hosts(self, label: Optional[str] = '', as_hostspec: bool = False) -> List: - return list(self.inventory.filter_by_label(label=label, as_hostspec=as_hostspec)) - def _add_host(self, spec): # type: (HostSpec) -> str """ diff --git a/src/pybind/mgr/cephadm/services/osd.py b/src/pybind/mgr/cephadm/services/osd.py index 9f350e82f585..4733f543e602 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -107,7 +107,8 @@ class OSDService(CephService): def prepare_drivegroup(self, drive_group: DriveGroupSpec) -> List[Tuple[str, DriveSelection]]: # 1) use fn_filter to determine matching_hosts - matching_hosts = drive_group.placement.filter_matching_hosts(self.mgr._get_hosts) + matching_hosts = drive_group.placement.filter_matching_hostspecs( + self.mgr.inventory.all_specs()) # 2) Map the inventory to the InventoryHost object host_ds_map = [] @@ -205,7 +206,7 @@ class OSDService(CephService): if not osdspecs: self.mgr.log.debug("No OSDSpecs found") return [] - return sum([spec.placement.filter_matching_hosts(self.mgr._get_hosts) for spec in osdspecs], []) + return sum([spec.placement.filter_matching_hostspecs(self.mgr.inventory.all_specs()) for spec in osdspecs], []) def resolve_osdspecs_for_host(self, host: str, specs: Optional[List[DriveGroupSpec]] = None): matching_specs = [] @@ -214,7 +215,7 @@ class OSDService(CephService): specs = [cast(DriveGroupSpec, spec) for (sn, spec) in self.mgr.spec_store.spec_preview.items() if spec.service_type == 'osd'] for spec in specs: - if host in spec.placement.filter_matching_hosts(self.mgr._get_hosts): + if host in spec.placement.filter_matching_hostspecs(self.mgr.inventory.all_specs()): self.mgr.log.debug(f"Found OSDSpecs for host: <{host}> -> <{spec}>") matching_specs.append(spec) return matching_specs diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 33d6b1bc6da6..227a35b9b442 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -188,6 +188,7 @@ class PlacementSpec(object): self.hosts = [HostPlacementSpec.parse(x, require_network=False) # type: ignore for x in hosts if x] + # deprecated def filter_matching_hosts(self, _get_hosts_func: Callable) -> List[str]: return self.filter_matching_hostspecs(_get_hosts_func(as_hostspec=True))