]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/ssh: take IP, CIDR, or addrvec for new mon(s)
authorSage Weil <sage@redhat.com>
Sat, 9 Nov 2019 04:39:10 +0000 (22:39 -0600)
committerSage Weil <sage@redhat.com>
Sat, 9 Nov 2019 04:39:45 +0000 (22:39 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/ssh/module.py

index 068fc2c0d3035c5c87b99d5d238e72919fcff6c8..1c5b7d6e97f65761644e6e0c50bc035064677a1d 100644 (file)
@@ -533,7 +533,7 @@ Usage:
         def split_host(host):
             """Split host into host and network parts"""
             # TODO: stricter validation
-            parts = host.split(":")
+            parts = host.split(":", 1)
             if len(parts) == 1:
                 return (parts[0], None)
             elif len(parts) == 2:
index 268513660dc0c0bf12e4e64df998469625c196c0..72ea3b664bab2886031488c9d90ed12b07174eff 100644 (file)
@@ -845,8 +845,18 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
             'entity': 'mon.',
         })
 
+        # infer whether this is a CIDR network, addrvec, or plain IP
+        if '/' in network:
+            extra_args = ['--mon-network', network]
+        elif network.startswith('[v') and network.endswith(']'):
+            extra_args = ['--mon-addrv', network]
+        elif ':' not in network:
+            extra_args = ['--mon-ip', network]
+        else:
+            raise RuntimeError('Must specify a CIDR network, ceph addrvec, or plain IP: \'%s\'' % network)
+
         return self._create_daemon('mon', host, host, keyring,
-                                   extra_args=['--mon-network', network])
+                                   extra_args=extra_args)
 
     def update_mons(self, num, hosts):
         """