From: Sage Weil Date: Tue, 23 Jul 2013 21:43:56 +0000 (-0700) Subject: ceph: add wait_for_mon_quorum command X-Git-Tag: 1.1.0~2057 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c1e0812b6a655c5d890b1d37e29870ba43b4bc33;p=teuthology.git ceph: add wait_for_mon_quorum command tasks: ... - ceph.wait_for_mon_quorum: [a, b] ... will block until the mon quorum consists of exactly [a, b]. This is compared directly to the relevant field from 'ceph quorum_status' which has the alphanumeric names only. Signed-off-by: Sage Weil --- diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index 4b2cca629c..fd1c780c7a 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -936,6 +936,29 @@ def healthy(ctx, config): remote=mon0_remote, ) +def wait_for_mon_quorum(ctx, config): + import json + import time + + assert isinstance(config, list) + firstmon = teuthology.get_first_mon(ctx, config) + (remote,) = ctx.cluster.only(firstmon).remotes.keys() + while True: + r = remote.run( + args=[ + 'ceph', + 'quorum_status', + ], + stdout=StringIO(), + logger=log.getChild('quorum_status'), + ) + j = json.loads(r.stdout.getvalue()) + q = j.get('quorum_names', []) + log.debug('Quorum: %s', q) + if sorted(q) == sorted(config): + break + time.sleep(1) + @contextlib.contextmanager def restart(ctx, config):