From: Sage Weil Date: Wed, 12 Feb 2020 21:05:29 +0000 (-0600) Subject: mgr/orch: add mon hook X-Git-Tag: v15.1.1~425^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=62b0e42360931a90a89af5670c6efd252abb94da;p=ceph.git mgr/orch: add mon hook Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 268c475f9e3..1621d091a45 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -960,6 +960,11 @@ class Orchestrator(object): """ raise NotImplementedError() + def add_mon(self, spec): + # type: (ServiceSpec) -> Completion + """Create a new mon daemon""" + raise NotImplementedError() + def add_mgr(self, spec): # type: (ServiceSpec) -> Completion """Create a new mgr daemon""" diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index ff97221c483..0f6b9ffe50b 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -387,6 +387,26 @@ Usage: orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( + 'orch daemon add mon', + "name=num,type=CephInt,req=false " + "name=hosts,type=CephString,n=N,req=false " + "name=label,type=CephString,req=false", + 'Start monitor daemon(s)') + def _daemon_add_mon(self, num=None, hosts=[], label=None): + if not num and not hosts and not label: + # Improve Error message. Point to parse_host_spec examples + raise orchestrator.OrchestratorValidationError("Mons need a placement spec. (num, host, network, name(opt))") + placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts) + placement.validate() + + spec = orchestrator.ServiceSpec(placement=placement) + + completion = self.add_mon(spec) + self._orchestrator_wait([completion]) + orchestrator.raise_if_exception(completion) + return HandleCommandResult(stdout=completion.result_str()) + @orchestrator._cli_write_command( 'orch daemon add mgr', "name=num,type=CephInt,req=false "