From: Sage Weil Date: Fri, 8 Nov 2019 16:12:27 +0000 (-0600) Subject: mgr/orchestrator: add rbd-mirror commands and hooks X-Git-Tag: v15.1.0~977^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4808104265f6c9ad321b79cf2f62365d7a50cab;p=ceph.git mgr/orchestrator: add rbd-mirror commands and hooks This is somewhat different from the other services in that the name is basically unused: we have a single pool of rbd-mirror daemons for the whole cluster. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 03923aefd6a..dc9e57f2fe9 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -496,6 +496,24 @@ class Orchestrator(object): """ raise NotImplementedError() + def add_rbd_mirror(self, spec): + # type: (StatelessServiceSpec) -> WriteCompletion + """Create rbd-mirror cluster""" + raise NotImplementedError() + + def remove_rbd_mirror(self): + # type: (str) -> WriteCompletion + """Remove rbd-mirror cluster""" + raise NotImplementedError() + + def update_rbd_mirror(self, spec): + # type: (StatelessServiceSpec) -> WriteCompletion + """ + Update / redeploy rbd-mirror cluster + Like for example changing the number of service instances. + """ + raise NotImplementedError() + def add_nfs(self, spec): # type: (NFSServiceSpec) -> WriteCompletion """Create a new MDS cluster""" diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 068fc2c0d30..cde3fde88e2 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -354,6 +354,34 @@ Usage: orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str()) + @_write_cli('orchestrator rbd-mirror add', + "name=num,type=CephInt,req=false " + "name=hosts,type=CephString,n=N,req=false", + 'Create an rbd-mirror service') + def _rbd_mirror_add(self, num=None, hosts=None): + spec = orchestrator.StatelessServiceSpec( + None, + placement=orchestrator.PlacementSpec(nodes=hosts), + count=num or 1) + completion = self.add_rbd_mirror(spec) + self._orchestrator_wait([completion]) + orchestrator.raise_if_exception(completion) + return HandleCommandResult(stdout=completion.result_str()) + + @_write_cli('orchestrator rbd-mirror update', + "name=num,type=CephInt,req=true " + "name=hosts,type=CephString,n=N,req=false", + 'Update the number of rbd-mirror instances') + def _rbd_mirror_update(self, num, hosts=None): + spec = orchestrator.StatelessServiceSpec( + None, + placement=orchestrator.PlacementSpec(nodes=hosts), + count=num or 1) + completion = self.update_rbd_mirror(spec) + self._orchestrator_wait([completion]) + orchestrator.raise_if_exception(completion) + return HandleCommandResult(stdout=completion.result_str()) + @_write_cli('orchestrator mds add', "name=fs_name,type=CephString " "name=num,type=CephInt,req=false " @@ -444,6 +472,15 @@ Usage: orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str()) + @_write_cli('orchestrator rbd-mirror rm', + "name=name,type=CephString,req=false", + 'Remove rbd-mirror service or rbd-mirror service instance') + def _rbd_mirror_rm(self, name=None): + completion = self.remove_rbd_mirror(name) + self._orchestrator_wait([completion]) + orchestrator.raise_if_exception(completion) + return HandleCommandResult(stdout=completion.result_str()) + @_write_cli('orchestrator mds rm', "name=name,type=CephString", 'Remove an MDS service (mds id or fs_name)')