From dda15a792431a509d18210bb00471015493d6ce6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 5 Oct 2021 16:36:05 -0500 Subject: [PATCH] qa/tasks/cephadm: wait for osds to start explicitly Signed-off-by: Sage Weil --- qa/tasks/cephadm.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index d3561338c86..8bd7f220c82 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -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: -- 2.39.5