MCPcopy Create free account
hub / github.com/ceph/ceph / set_hosts

Method set_hosts

src/python-common/ceph/deployment/service_spec.py:370–389  ·  view source on GitHub ↗
(self, hosts: Union[List[str], List[HostPlacementSpec]])

Source from the content-addressed store, hash-verified

368 return NotImplemented
369
370 def set_hosts(self, hosts: Union[List[str], List[HostPlacementSpec]]) -> None:
371 # To backpopulate the .hosts attribute when using labels or count
372 # in the orchestrator backend.
373 if all(isinstance(h, HostPlacementSpec) for h in hosts):
374 # All items are HostPlacementSpec, normalize directly.
375 host_specs = cast(List[HostPlacementSpec], hosts)
376 self.hosts = [
377 HostPlacementSpec(
378 normalize_hostname(h.hostname),
379 h.network,
380 h.name,
381 )
382 for h in host_specs
383 ]
384 else:
385 # Otherwise, parse from strings
386 self.hosts = [
387 HostPlacementSpec.parse(h, require_network=False) # type: ignore
388 for h in hosts if h
389 ]
390
391 # deprecated
392 def filter_matching_hosts(self, _get_hosts_func: Callable) -> List[str]:

Callers 1

__init__Method · 0.95

Calls 4

normalize_hostnameFunction · 0.90
allFunction · 0.85
HostPlacementSpecClass · 0.85
parseMethod · 0.45

Tested by

no test coverage detected