From fc2e7650799c07395492fae4c7b3357e486caa70 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 8 Nov 2019 22:39:10 -0600 Subject: [PATCH] mgr/ssh: take IP, CIDR, or addrvec for new mon(s) Signed-off-by: Sage Weil --- src/pybind/mgr/orchestrator_cli/module.py | 2 +- src/pybind/mgr/ssh/module.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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): """ -- 2.39.5