From: Sage Weil Date: Tue, 20 Apr 2021 14:01:22 +0000 (-0400) Subject: mgr/cephadm: do not schedule on _no_schedule hosts X-Git-Tag: v16.2.5~39^2~4^2^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=30b400d59552a770fd0f1012581c21ea2ba38a49;p=ceph.git mgr/cephadm: do not schedule on _no_schedule hosts Reuse and rename existing helper to return schedulable hosts. Signed-off-by: Sage Weil (cherry picked from commit f260c48f723641a5f82c64c0e31451199aa191f8) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index d06775e1023..04f857d3726 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1270,7 +1270,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, return image - def _hosts_with_daemon_inventory(self) -> List[HostSpec]: + def _schedulable_hosts(self) -> List[HostSpec]: """ Returns all usable hosts that went through _refresh_host_daemons(). @@ -1281,8 +1281,11 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, """ 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'] + if ( + self.cache.host_had_daemon_refresh(h.hostname) + and h.status.lower() not in ['maintenance', 'offline'] + and '_no_schedule' not in h.labels + ) ] def _add_host(self, spec): @@ -2101,7 +2104,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, ha = HostAssignment( spec=spec, - hosts=self._hosts_with_daemon_inventory(), + hosts=self._schedulable_hosts(), networks=self.cache.networks, daemons=self.cache.get_daemons_by_service(spec.service_name()), allow_colo=self.cephadm_services[spec.service_type].allow_colo(), diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 418cecf6078..f17219730c4 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -546,7 +546,7 @@ class CephadmServe: ha = HostAssignment( spec=spec, - hosts=self.mgr._hosts_with_daemon_inventory(), + hosts=self.mgr._schedulable_hosts(), daemons=daemons, networks=self.mgr.cache.networks, filter_new_host=(