From: Vasu Kulkarni Date: Mon, 2 May 2016 19:43:52 +0000 (-0700) Subject: Fix infinite wait during monitor quorum check X-Git-Tag: v11.1.1~58^2^2~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16144d8e544bbf4b9863039f875701fd83fa3763;p=ceph.git Fix infinite wait during monitor quorum check Signed-off-by: Vasu Kulkarni --- diff --git a/tasks/ceph.py b/tasks/ceph.py index 062012c13ab..e05ab9b94c9 100644 --- a/tasks/ceph.py +++ b/tasks/ceph.py @@ -1211,22 +1211,23 @@ def wait_for_mon_quorum(ctx, config): cluster_name = 'ceph' firstmon = teuthology.get_first_mon(ctx, config, cluster_name) (remote,) = ctx.cluster.only(firstmon).remotes.keys() - while True: - r = remote.run( - args=[ - 'sudo', - '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(mons): - break - time.sleep(1) + with contextutil.safe_while(sleep=10, tries=60, + action='wait for monitor quorum') as proceed: + while proceed(): + r = remote.run( + args=[ + 'sudo', + '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(mons): + break def created_pool(ctx, config):