From: Stanislav Datskevych Date: Tue, 27 Apr 2021 06:16:33 +0000 (+0200) Subject: cephadm: allow several public networks be matched X-Git-Tag: v16.2.5~39^2~4^2^2~20 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=099605b10adf3ae61e9fa9c496eba09559841794;p=ceph.git cephadm: allow several public networks be matched Fixes: https://tracker.ceph.com/issues/50548 Signed-off-by: Stanislav Datskevych (cherry picked from commit cdd7d20b35676c4627a5caa58e4838fc59e57554) --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index ea2d8a296102d..d39d27c8e9c8d 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -529,20 +529,23 @@ class CephadmServe: svc = self.mgr.cephadm_services[service_type] daemons = self.mgr.cache.get_daemons_by_service(service_name) - public_network = None + public_networks: List[str] = [] if service_type == 'mon': out = str(self.mgr.get_foreign_ceph_option('mon', 'public_network')) if '/' in out: - public_network = out.strip() - self.log.debug('mon public_network is %s' % public_network) + public_networks = [x.strip() for x in out.split(',')] + self.log.debug('mon public_network(s) is %s' % public_networks) def matches_network(host): # type: (str) -> bool - if not public_network: + if len(public_networks) == 0: return False - # make sure we have 1 or more IPs for that network on that + # make sure we have 1 or more IPs for any of those networks on that # host - return len(self.mgr.cache.networks[host].get(public_network, [])) > 0 + for network in public_networks: + if len(self.mgr.cache.networks[host].get(network, [])) > 0: + return True + return False ha = HostAssignment( spec=spec,