]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: allow several public networks be matched
authorStanislav Datskevych <me@nek0.net>
Tue, 27 Apr 2021 06:16:33 +0000 (08:16 +0200)
committerSage Weil <sage@newdream.net>
Tue, 4 May 2021 16:20:55 +0000 (11:20 -0500)
Fixes: https://tracker.ceph.com/issues/50548
Signed-off-by: Stanislav Datskevych <me@nek0.net>
(cherry picked from commit cdd7d20b35676c4627a5caa58e4838fc59e57554)

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,