From 77f42f3c011bd77439f249e0290189242db6f0ae Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 28 Oct 2019 14:12:37 -0500 Subject: [PATCH] mgr/rook: implement update_mds Note that this still doesn't provide control over active vs standby MDS counts. Signed-off-by: Sage Weil --- src/pybind/mgr/rook/module.py | 6 ++++++ src/pybind/mgr/rook/rook_cluster.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index 1acf5582c29..2d196ecac22 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -427,6 +427,12 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): lambda: self.rook_cluster.update_mon_count(num), None, "Updating mon count to {0}".format(num)) + def update_mds(self, spec): + num = spec.count + return RookWriteCompletion( + lambda: self.rook_cluster.update_mds_count(spec.name, num), None, + "Updating MDS server count in {0} to {1}".format(spec.name, num)) + def update_nfs(self, spec): num = spec.count return RookWriteCompletion( diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index fc147f70139..4d4c3ed76e6 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -454,6 +454,20 @@ class RookCluster(object): return "Updated mon count to {0}".format(newcount) + def update_mds_count(self, svc_id, newcount): + patch = [{"op": "replace", "path": "/spec/metadataServer/activeCount", + "value": newcount}] + + try: + self.rook_api_patch( + "cephfilesystems/{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 update_nfs_count(self, svc_id, newcount): patch = [{"op": "replace", "path": "/spec/server/active", "value": newcount}] -- 2.39.5