From: Alfredo Deza Date: Wed, 2 Nov 2016 16:19:10 +0000 (-0400) Subject: ceph-create-keys: wait for quorum for ten minutes, not forever X-Git-Tag: v0.94.10~6^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b3bc5fbc55da3cb2ce036ef3df367832d7a59e2;p=ceph.git ceph-create-keys: wait for quorum for ten minutes, not forever Signed-off-by: Alfredo Deza (cherry picked from commit 32cedd2c18e48d5f9a1547e5fd69c24c7eac1638) --- diff --git a/src/ceph-create-keys b/src/ceph-create-keys index 57eaf1744c1a..6f32070e113b 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -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(