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
"""
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 = []
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 = []
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
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))