From: Sage Weil Date: Sat, 9 Nov 2019 04:39:10 +0000 (-0600) Subject: mgr/ssh: take IP, CIDR, or addrvec for new mon(s) X-Git-Tag: v15.1.0~968^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fc2e7650799c07395492fae4c7b3357e486caa70;p=ceph-ci.git mgr/ssh: take IP, CIDR, or addrvec for new mon(s) Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 068fc2c0d30..1c5b7d6e97f 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -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: diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 268513660dc..72ea3b664ba 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -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): """