]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: deprecate filter_matching_hosts
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 14 Sep 2020 09:34:32 +0000 (11:34 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2020 09:40:53 +0000 (11:40 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 7b7aeafad1bb4e3f0818417008f5df616de8f90c)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/osd.py
src/python-common/ceph/deployment/service_spec.py

index b35562c275ce458f4f25e5275e46d2dc2c84479d..655d75674c858c34ad27cd5d7f30c7590cf2d5ce 100644 (file)
@@ -1239,9 +1239,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
         """
index 000d4bb981e61ed6d668eb59e4a3c48caebc6026..87ea6a8482a3e719f8dda86715d86d89129d3488 100644 (file)
@@ -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 = []
 
@@ -211,7 +212,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 = []
@@ -220,7 +221,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
index f5e1e3ca2c031f20f1a8eeb86a1af94229c2095e..f4c7e95c31beb1549c364884d5d3604a581b1d12 100644 (file)
@@ -189,6 +189,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))