From: Jeff Layton Date: Mon, 25 Feb 2019 14:21:08 +0000 (-0500) Subject: mgr/orchestrator: allow scaling the NFS server count up and down X-Git-Tag: v14.1.1~40^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26633%2Fhead;p=ceph.git mgr/orchestrator: allow scaling the NFS server count up and down Add a new 'ceph orchestrator nfs update' command that will take the NFS clustername and a new count as arguments. That will get translated to a StatelessServiceSpec and passed to update_stateless_service. Also, add the necessary stubs to the test_orchestrator and the CLI QA test. Signed-off-by: Jeff Layton --- diff --git a/qa/tasks/mgr/test_orchestrator_cli.py b/qa/tasks/mgr/test_orchestrator_cli.py index 90bae17f2448..bbb8fb80cfbd 100644 --- a/qa/tasks/mgr/test_orchestrator_cli.py +++ b/qa/tasks/mgr/test_orchestrator_cli.py @@ -126,3 +126,6 @@ class TestOrchestratorCli(MgrTestCase): def test_mgr_update(self): self._orch_cmd("mgr", "update", "3") + + def test_nfs_update(self): + self._orch_cmd("nfs", "update", "service_name", "2") diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 37a8dcd4966b..2bfa7e205973 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -268,6 +268,19 @@ Usage: def _nfs_rm(self, svc_id): return self._rm_stateless_svc("nfs", svc_id) + @CLIWriteCommand('orchestrator nfs update', + "name=svc_id,type=CephString " + "name=num,type=CephInt", + 'Scale an NFS service') + @handle_exceptions + def _nfs_update(self, svc_id, num): + spec = orchestrator.StatelessServiceSpec() + spec.name = svc_id + spec.count = num + completion = self.update_stateless_service("nfs", spec) + self._orchestrator_wait([completion]) + return HandleCommandResult() + @CLIWriteCommand('orchestrator service', "name=action,type=CephChoices,strings=start|stop|reload " "name=svc_type,type=CephString " diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index 9a272e3568d5..9c9f5acbc2ce 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -270,6 +270,10 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): def remove_stateless_service(self, service_type, id_): pass + @deferred_write("update_stateless_service") + def update_stateless_service(self, service_type, spec): + pass + @deferred_read def get_hosts(self): return [orchestrator.InventoryNode('localhost', [])]