]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: allow scaling the NFS server count up and down 26633/head
authorJeff Layton <jlayton@redhat.com>
Mon, 25 Feb 2019 14:21:08 +0000 (09:21 -0500)
committerJeff Layton <jlayton@redhat.com>
Wed, 6 Mar 2019 12:15:14 +0000 (07:15 -0500)
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 <jlayton@redhat.com>
qa/tasks/mgr/test_orchestrator_cli.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/test_orchestrator/module.py

index 90bae17f2448842302ec6e1e542b47f64e9d7cdc..bbb8fb80cfbd1fd12a2bdd45a2aefdb0c7fb65dc 100644 (file)
@@ -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")
index 37a8dcd4966b34eacc6be37d01495fb11a7bddcb..2bfa7e205973a3ff821f4d2b48630b945ce58dc5 100644 (file)
@@ -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 "
index 9a272e3568d54922e1bf53031a7b46eabd7fa729..9c9f5acbc2ce8642d773e866d5e02a646a0cf5bd 100644 (file)
@@ -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', [])]