From: Jeff Layton Date: Wed, 13 Feb 2019 13:10:51 +0000 (-0500) Subject: mgr/rook: add the ability to scale the mon count X-Git-Tag: v14.1.0~64^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6526fb9023e654ee4cb09b874d9f9b92cd66e85e;p=ceph.git mgr/rook: add the ability to scale the mon count Signed-off-by: Jeff Layton --- diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index f9ae9d07a6a..0aac98a23d7 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -392,6 +392,14 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): lambda: self.rook_cluster.rm_service(service_type, service_id), None, "Removing {0} services for {1}".format(service_type, service_id)) + def update_mons(self, num, hosts): + if hosts: + raise RuntimeError("Host list is not supported by rook.") + + return RookWriteCompletion( + lambda: self.rook_cluster.update_mon_count(num), None, + "Updating mon count to {0}".format(num)) + def create_osds(self, drive_group, all_hosts): # type: (orchestrator.DriveGroupSpec, List[str]) -> RookWriteCompletion diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index 5d319b4758c..f42b95a0b5d 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -337,6 +337,20 @@ class RookCluster(object): else: return True + def update_mon_count(self, newcount): + patch = [{"op": "replace", "path": "/spec/mon/count", "value": newcount}] + + try: + self.rook_api_patch( + "cephclusters/{0}".format(self.cluster_name), + body=patch) + except ApiException as e: + log.exception("API exception: {0}".format(e)) + raise ApplyException( + "Failed to update mon count in Cluster CRD: {0}".format(e)) + + return "Updated mon count to {0}".format(newcount) + def add_osds(self, drive_group, all_hosts): # type: (orchestrator.DriveGroupSpec, List[str]) -> None """