]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephadm: wait for osds to start explicitly
authorSage Weil <sage@newdream.net>
Tue, 5 Oct 2021 21:36:05 +0000 (16:36 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 13 Dec 2021 08:51:51 +0000 (09:51 +0100)
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit dda15a792431a509d18210bb00471015493d6ce6)

qa/tasks/cephadm.py

index d3561338c86961c48f67789c230ab69c54dd4860..8bd7f220c82f1b8064d1cad32575554aff50c134 100644 (file)
@@ -760,6 +760,21 @@ def ceph_osds(ctx, config):
             _shell(ctx, cluster_name, remote, [
                 'ceph', 'orch', 'apply', 'osd', '--all-available-devices',
             ])
+            # expect the number of scratch devs
+            num_osds = sum(map(len, devs_by_remote.values()))
+            assert num_osds
+        else:
+            # expect the number of OSDs we created
+            num_osds = cur
+
+        log.info(f'Waiting for {num_osds} OSDs to come up...')
+        with contextutil.safe_while(sleep=1, tries=120) as proceed:
+            while proceed():
+                p = _shell(ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote,
+                           ['ceph', 'osd', 'stat', '-f', 'json'], stdout=StringIO())
+                j = json.loads(p.stdout.getvalue())
+                if int(j.get('num_up_osds', 0)) == num_osds:
+                    break;
 
         yield
     finally: