From 32cedd2c18e48d5f9a1547e5fd69c24c7eac1638 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 2 Nov 2016 12:19:10 -0400 Subject: [PATCH] ceph-create-keys: wait for quorum for ten minutes, not forever Signed-off-by: Alfredo Deza --- src/ceph-create-keys | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ceph-create-keys b/src/ceph-create-keys index 8031b2fb257..78525c634be 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -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( -- 2.39.5