]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: explicitly wait for mon to start
authorSage Weil <sage@redhat.com>
Wed, 9 Oct 2019 21:40:46 +0000 (16:40 -0500)
committerSage Weil <sage@redhat.com>
Mon, 21 Oct 2019 15:43:48 +0000 (10:43 -0500)
All this does is make things easier to understand if there is a failure
that prevents the mon from responding.

Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 6306f178b38cd8c6b15bb126c4b77f2242aa468e..1579938c3d3c9947b915846817792f9373dbee37 100755 (executable)
@@ -816,6 +816,26 @@ def command_bootstrap():
     mon_c = get_container(fsid, 'mon', mon_id)
     deploy_daemon_units(fsid, 'mon', mon_id, mon_c)
 
+    logger.info('Waiting for mon to start...')
+    while True:
+        c = CephContainer(
+            image=args.image,
+            entrypoint='/usr/bin/ceph',
+            args=[
+                '-n', 'mon.',
+                '-k', '/var/lib/ceph/mon/ceph-%s/keyring' % mon_id,
+                '-c', '/var/lib/ceph/mon/ceph-%s/config' % mon_id,
+                'status'],
+            volume_mounts={
+                mon_dir: '/var/lib/ceph/mon/ceph-%s:z' % (mon_id),
+            },
+        )
+        out, err, ret = call(c.run_cmd(), c.entrypoint)
+        if ret == 0:
+            break
+        logger.info('mon is still not available yet, waiting...')
+        time.sleep(1)
+
     # assimilate and minimize config
     if not args.no_minimize_config:
         logger.info('Assimilating anything we can from ceph.conf...')