]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: add the ability to scale the mon count 26405/head
authorJeff Layton <jlayton@redhat.com>
Wed, 13 Feb 2019 13:10:51 +0000 (08:10 -0500)
committerJeff Layton <jlayton@redhat.com>
Wed, 13 Feb 2019 14:10:42 +0000 (09:10 -0500)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/pybind/mgr/rook/module.py
src/pybind/mgr/rook/rook_cluster.py

index f9ae9d07a6a159cdce1f0106322dffceb8e55e3b..0aac98a23d79b558b4d2a66b7fce2932cd820240 100644 (file)
@@ -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
 
index 5d319b4758c19d8274808c10846859ddb393c531..f42b95a0b5d006a899ec816538e9d8542b06d61b 100644 (file)
@@ -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
         """