From: Sebastian Wagner Date: Wed, 20 Oct 2021 09:49:33 +0000 (+0200) Subject: Merge pull request #42772 from Daniel-Pivonka/cephadm-add-existing-host X-Git-Tag: v17.1.0~637 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a1ac0ec7200ea1f89161d77cb1e39844b668ca40;p=ceph.git Merge pull request #42772 from Daniel-Pivonka/cephadm-add-existing-host mgr/cephadm: update host when adding host that already exists Reviewed-by: Adam King Reviewed-by: Sebastian Wagner --- a1ac0ec7200ea1f89161d77cb1e39844b668ca40 diff --cc src/pybind/mgr/cephadm/module.py index f48bb3693571f,c6fddc271b795..14f10af8095a7 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@@ -1277,7 -1378,31 +1277,12 @@@ class CephadmOrchestrator(orchestrator. 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)