]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix infinite wait during monitor quorum check
authorVasu Kulkarni <vasu@redhat.com>
Mon, 2 May 2016 19:43:52 +0000 (12:43 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Mon, 5 Dec 2016 23:42:14 +0000 (15:42 -0800)
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
tasks/ceph.py

index 062012c13ab1b57cae6427a0d55722aba0a9a244..e05ab9b94c9396f568f9a21e5004b59428418f59 100644 (file)
@@ -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):