]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: allow several public networks be matched 41055/head
authorStanislav Datskevych <me@nek0.net>
Tue, 27 Apr 2021 06:16:33 +0000 (08:16 +0200)
committerStanislav Datskevych <me@nek0.net>
Wed, 28 Apr 2021 10:39:21 +0000 (12:39 +0200)
Fixes: https://tracker.ceph.com/issues/50548
Signed-off-by: Stanislav Datskevych <me@nek0.net>
src/pybind/mgr/cephadm/serve.py

index ea2d8a296102d5156fdef0b17299b61a8530ddf0..d39d27c8e9c8d01cf53824e93eaa8bc1420389f2 100644 (file)
@@ -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,