From 60863f70eb4fb0e632a9dd9735b930b03129cae4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 8 Nov 2011 22:02:58 -0800 Subject: [PATCH] ceph_manager: manipulate monitors --- teuthology/task/ceph_manager.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/teuthology/task/ceph_manager.py b/teuthology/task/ceph_manager.py index 1d63967b6bf0c..17fee79d9402a 100644 --- a/teuthology/task/ceph_manager.py +++ b/teuthology/task/ceph_manager.py @@ -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) + + + -- 2.39.5