From: Sage Weil Date: Thu, 21 Nov 2019 16:48:27 +0000 (-0600) Subject: qa/tasks/ceph2: use safe_while X-Git-Tag: v15.1.0~790^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=96e9b8bc29ffab0b99b1b103bd78acf9ae555db5;p=ceph-ci.git qa/tasks/ceph2: use safe_while Signed-off-by: Sage Weil --- diff --git a/qa/tasks/ceph2.py b/qa/tasks/ceph2.py index 20c949ac1b3..3290d90e048 100644 --- a/qa/tasks/ceph2.py +++ b/qa/tasks/ceph2.py @@ -405,21 +405,21 @@ def ceph_mons(ctx, config): started=True, ) - while True: - log.info('Waiting for %d mons in monmap...' % (num_mons)) - r = shell( - ctx=ctx, - cluster_name=cluster_name, - remote=remote, - args=[ - 'ceph', 'mon', 'dump', '-f', 'json', - ], - stdout=StringIO(), - ) - j = json.loads(r.stdout.getvalue()) - if len(j['mons']) == num_mons: - break - time.sleep(1) + with contextutil.safe_while(sleep=1, tries=180) as proceed: + while proceed(): + log.info('Waiting for %d mons in monmap...' % (num_mons)) + r = shell( + ctx=ctx, + cluster_name=cluster_name, + remote=remote, + args=[ + 'ceph', 'mon', 'dump', '-f', 'json', + ], + stdout=StringIO(), + ) + j = json.loads(r.stdout.getvalue()) + if len(j['mons']) == num_mons: + break # refresh ceph.conf files for all mons + first mgr """