]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: allow scaling nfs count
authorJeff Layton <jlayton@redhat.com>
Mon, 25 Feb 2019 14:27:02 +0000 (09:27 -0500)
committerJeff Layton <jlayton@redhat.com>
Wed, 6 Mar 2019 12:14:46 +0000 (07:14 -0500)
Allow rook to handle scaling the NFS server count up and down in an NFS
cluster. We just manifest these changes as change to the
spec.server.active field in the CRD.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/pybind/mgr/rook/module.py
src/pybind/mgr/rook/rook_cluster.py

index 0aac98a23d79b558b4d2a66b7fce2932cd820240..1e032bd82e67ab7d8c8eedc6d40994a083c33ea3 100644 (file)
@@ -400,6 +400,16 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
             lambda: self.rook_cluster.update_mon_count(num), None,
             "Updating mon count to {0}".format(num))
 
+    def update_stateless_service(self, svc_type, spec):
+        # only nfs is currently supported
+        if svc_type != "nfs":
+            raise NotImplementedError(svc_type)
+
+        num = spec.count
+        return RookWriteCompletion(
+            lambda: self.rook_cluster.update_nfs_count(spec.name, num), None,
+                "Updating NFS server count in {0} to {1}".format(spec.name, num))
+
     def create_osds(self, drive_group, all_hosts):
         # type: (orchestrator.DriveGroupSpec, List[str]) -> RookWriteCompletion
 
index b180dcfb30e4b1f65214c0f2313e437f8a3cf40c..2e1efbff31a61bc3fcb60c33908bb010f5370edb 100644 (file)
@@ -348,6 +348,19 @@ class RookCluster(object):
 
         return "Updated mon count to {0}".format(newcount)
 
+    def update_nfs_count(self, svc_id, newcount):
+        patch = [{"op": "replace", "path": "/spec/server/active", "value": newcount}]
+
+        try:
+            self.rook_api_patch(
+                "cephnfses/{0}".format(svc_id),
+                body=patch)
+        except ApiException as e:
+            log.exception("API exception: {0}".format(e))
+            raise ApplyException(
+                "Failed to update NFS server count for {0}: {1}".format(svc_id, e))
+        return "Updated NFS server count for {0} to {1}".format(svc_id, newcount)
+
     def add_osds(self, drive_group, all_hosts):
         # type: (orchestrator.DriveGroupSpec, List[str]) -> None
         """