]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_manager: manipulate monitors
authorSage Weil <sage@newdream.net>
Wed, 9 Nov 2011 06:02:58 +0000 (22:02 -0800)
committerSage Weil <sage@newdream.net>
Wed, 9 Nov 2011 06:17:00 +0000 (22:17 -0800)
teuthology/task/ceph_manager.py

index 1d63967b6bf0cc8f0a96356d0a1ee4bc1de35fa5..17fee79d9402a89875cbfcf5ffb5267bc071d777 100644 (file)
@@ -278,3 +278,35 @@ class CephManager:
 
     def mark_in_osd(self, osd):
         self.raw_cluster_cmd('osd', 'in', str(osd))
+
+
+    ## monitors
+
+    def kill_mon(self, mon):
+        self.ctx.daemons.get_daemon('mon', mon).stop()
+
+    def revive_mon(self, mon):
+        self.ctx.daemons.get_daemon('mon', mon).restart()
+
+    def get_mon_status(self, mon):
+        addr = self.ctx.ceph.conf['mon.%s' % mon]['mon addr']
+        out = self.raw_cluster_cmd('-m', addr, 'mon_status')
+        return json.loads(out)
+
+    def get_mon_quorum(self):
+        out = self.raw_cluster_cmd('quorum_status')
+        j = json.loads(out)
+        return j['quorum']
+
+    def wait_for_mon_quorum_size(self, size, timeout=None):
+        self.log('waiting for quorum size %d' % size)
+        start = time.time()
+        while not len(self.get_mon_quorum()) == size:
+            if timeout is not None:
+                assert time.time() - start < timeout, \
+                    'failed to reach quorum size %d before timeout expired' % size
+            time.sleep(3)
+        self.log("quorum is size %d" % size)
+                
+
+