]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-create-keys: wait 10 minutes to get or create the bootstrap key, not forever 12805/head
authorAlfredo Deza <adeza@redhat.com>
Wed, 2 Nov 2016 16:28:49 +0000 (12:28 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 5 Jan 2017 21:30:49 +0000 (22:30 +0100)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit bea802bd13df883d06b7b67a83ac6540e44ab6c1)

src/ceph-create-keys

index c2f69423ccb10c5b4bdee0846e51d0930cf98ba6..5e7a6934f00dac57ada0b055927bc4b67a1f9bef 100755 (executable)
@@ -58,7 +58,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):
@@ -151,7 +151,8 @@ def bootstrap_key(cluster, type_):
     if not os.path.exists(pathdir):
         os.makedirs(pathdir)
 
-    while True:
+    wait_count = 600  # 10 minutes
+    while wait_count > 0:
         try:
             with file(tmp, 'w') as f:
                 os.fchmod(f.fileno(), 0600)
@@ -167,6 +168,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)
@@ -179,6 +181,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():