From: Alfredo Deza Date: Wed, 2 Nov 2016 16:28:49 +0000 (-0400) Subject: ceph-create-keys: wait 10 minutes to get or create the bootstrap key, not forever X-Git-Tag: v10.2.6~30^2~10^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=98800933cfbb8d0e3ef64c358c9f02b3f8bb845a;p=ceph.git ceph-create-keys: wait 10 minutes to get or create the bootstrap key, not forever Signed-off-by: Alfredo Deza (cherry picked from commit bea802bd13df883d06b7b67a83ac6540e44ab6c1) --- diff --git a/src/ceph-create-keys b/src/ceph-create-keys index ea19857ae5b..d1dce4209b4 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -74,7 +74,7 @@ def wait_for_quorum(cluster, mon_id): break if wait_count == 0: - LOG.error("ceph-mon was not able to join quorum within 10 minutes") + raise SystemExit("ceph-mon was not able to join quorum within 10 minutes") def get_key(cluster, mon_id): @@ -189,7 +189,8 @@ def bootstrap_key(cluster, type_): os.chmod(pathdir, 0770) os.chown(pathdir, get_ceph_uid(), get_ceph_gid()) - while True: + wait_count = 600 # 10 minutes + while wait_count > 0: try: with file(tmp, 'w') as f: os.fchmod(f.fileno(), 0600) @@ -206,6 +207,7 @@ def bootstrap_key(cluster, type_): else: LOG.info('Cannot get or create bootstrap key for %s', type_) time.sleep(1) + wait_count -= 1 continue os.rename(tmp, path) @@ -218,6 +220,8 @@ def bootstrap_key(cluster, type_): pass else: raise + if wait_count == 0: + raise SystemExit("Could not get or create %s bootstrap key after 10 minutes" % type_) def parse_args():