]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-create-keys: wait for quorum for ten minutes, not forever
authorAlfredo Deza <adeza@redhat.com>
Wed, 2 Nov 2016 16:19:10 +0000 (12:19 -0400)
committerNathan Cutler <ncutler@suse.com>
Mon, 14 Nov 2016 16:08:00 +0000 (17:08 +0100)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 32cedd2c18e48d5f9a1547e5fd69c24c7eac1638)

src/ceph-create-keys

index 8031b2fb257cc152521329e04d187fe003c215f0..78525c634be5d6eb329c536513771723023aa98f 100755 (executable)
@@ -30,7 +30,8 @@ def get_ceph_gid():
     return gid
 
 def wait_for_quorum(cluster, mon_id):
-    while True:
+    wait_count = 600  # 10 minutes
+    while wait_count > 0:
         p = subprocess.Popen(
             args=[
                 'ceph',
@@ -48,11 +49,13 @@ def wait_for_quorum(cluster, mon_id):
         if returncode != 0:
             LOG.info('ceph-mon admin socket not ready yet.')
             time.sleep(1)
+            wait_count -= 1
             continue
 
         if out == '':
             LOG.info('ceph-mon admin socket returned no data')
             time.sleep(1)
+            wait_count -= 1
             continue
 
         try:
@@ -65,10 +68,14 @@ def wait_for_quorum(cluster, mon_id):
         if state not in QUORUM_STATES:
             LOG.info('ceph-mon is not in quorum: %r', state)
             time.sleep(1)
+            wait_count -= 1
             continue
 
         break
 
+    if wait_count == 0:
+        LOG.error("ceph-mon was not able to join quorum within ten minutes")
+
 
 def get_key(cluster, mon_id):
     path = '/etc/ceph/{cluster}.client.admin.keyring'.format(