]> 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>
Thu, 5 Jan 2017 21:27:00 +0000 (22:27 +0100)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 32cedd2c18e48d5f9a1547e5fd69c24c7eac1638)

src/ceph-create-keys

index 57eaf1744c1a64c1506ddfc61673372c4cab7ad9..6f32070e113b7108b9e972d4a8ac75ab99020659 100755 (executable)
@@ -14,7 +14,8 @@ LOG = logging.getLogger(os.path.basename(sys.argv[0]))
 QUORUM_STATES = ['leader', 'peon']
 
 def wait_for_quorum(cluster, mon_id):
-    while True:
+    wait_count = 600  # 10 minutes
+    while wait_count > 0:
         p = subprocess.Popen(
             args=[
                 'ceph',
@@ -32,11 +33,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:
@@ -49,10 +52,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(