return image
- def _schedulable_hosts(self) -> List[HostSpec]:
- """
- Returns all usable hosts that went through _refresh_host_daemons().
-
- This mitigates a potential race, where new host was added *after*
- ``_refresh_host_daemons()`` was called, but *before*
- ``_apply_all_specs()`` was called. thus we end up with a hosts
- where daemons might be running, but we have not yet detected them.
- """
- return [
- h for h in self.inventory.all_specs()
- if (
- self.cache.host_had_daemon_refresh(h.hostname)
- and h.status.lower() not in ['maintenance', 'offline']
- and h.hostname not in self.offline_hosts
- and '_no_schedule' not in h.labels
- )
- ]
-
def _check_valid_addr(self, host: str, addr: str) -> str:
+ # make sure mgr is not resolving own ip
+ if addr in self.get_mgr_id():
+ raise OrchestratorError(
+ "Can not automatically resolve ip address of host where active mgr is running. Please explicitly provide the address.")
+
# make sure hostname is resolvable before trying to make a connection
try:
ip_addr = utils.resolve_ip(addr)