From 9d50154a93644ae21ccffc278cdc359e7dd5af2c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 15 Nov 2021 12:00:52 -0600 Subject: [PATCH] qa/tasks/cephadm: pull image to all hosts in parallel This doesn't affect bootstrap, but it does mean we avoid any delay the first time we cephadm.shell on some non-boostrap host. Signed-off-by: Sage Weil --- qa/tasks/cephadm.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index edc4aad8521ce..d87c773aab683 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -343,6 +343,28 @@ def ceph_crash(ctx, config): pass +@contextlib.contextmanager +def pull_image(ctx, config): + cluster_name = config['cluster'] + log.info(f'Pulling image {ctx.ceph[cluster_name].image} on all hosts...') + run.wait( + ctx.cluster.run( + args=[ + 'sudo', + ctx.cephadm, + '--image', ctx.ceph[cluster_name].image, + 'pull', + ], + wait=False, + ) + ) + + try: + yield + finally: + pass + + @contextlib.contextmanager def ceph_bootstrap(ctx, config): """ @@ -1493,6 +1515,7 @@ def task(ctx, config): else download_cephadm(ctx=ctx, config=config, ref=ref), lambda: ceph_log(ctx=ctx, config=config), lambda: ceph_crash(ctx=ctx, config=config), + lambda: pull_image(ctx=ctx, config=config), lambda: _bypass() if (ctx.ceph[cluster_name].bootstrapped)\ else ceph_bootstrap(ctx, config), lambda: crush_setup(ctx=ctx, config=config), -- 2.39.5