self._inventory[host]['labels'].remove(label)
self.save()
+ def has_label(self, host: str, label: str) -> bool:
+ return (
+ host in self._inventory
+ and label in self._inventory[host].get('labels', [])
+ )
+
def get_addr(self, host: str) -> str:
self.assert_host(host)
return self._inventory[host].get('addr', host)
self.mgr.log.debug("skipping apply of %s on %s (no change)" % (
host, drive_group))
return None
+ # skip this host if we cannot schedule here
+ if self.mgr.inventory.has_label(host, '_no_schedule'):
+ return None
cmd = self.driveselection_to_ceph_volume(drive_selection,
osd_id_claims.get(host, []))
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_hostspecs(
- self.mgr.inventory.all_specs())
+ self.mgr._schedulable_hosts())
# 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_hostspecs(self.mgr.inventory.all_specs()) for spec in osdspecs], [])
+ return sum([spec.placement.filter_matching_hostspecs(self.mgr._schedulable_hosts()) for spec in osdspecs], [])
def resolve_osdspecs_for_host(self, host: str,
specs: Optional[List[DriveGroupSpec]] = None) -> List[DriveGroupSpec]:
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_hostspecs(self.mgr.inventory.all_specs()):
+ if host in spec.placement.filter_matching_hostspecs(self.mgr._schedulable_hosts()):
self.mgr.log.debug(f"Found OSDSpecs for host: <{host}> -> <{spec}>")
matching_specs.append(spec)
return matching_specs