From 8dd0154c3e3484128b18f674f50a3332926a105b Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 5 Oct 2021 13:31:02 -0400 Subject: [PATCH] qa: move CephManager cluster instantiation to subtask This needs to be available for the cephfs_setup task so administration mounts can run ceph commands, potentially through `cephadm shell`. Signed-off-by: Patrick Donnelly (cherry picked from commit 7812cfb6744fc3bce50e26aa7dd6a4e47a43bb23) --- qa/tasks/ceph.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 48e2f91cb8b4..a6eab9be808a 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -376,6 +376,20 @@ def crush_setup(ctx, config): yield +@contextlib.contextmanager +def setup_manager(ctx, config): + first_mon = teuthology.get_first_mon(ctx, config, config['cluster']) + (mon,) = ctx.cluster.only(first_mon).remotes.keys() + if not hasattr(ctx, 'managers'): + ctx.managers = {} + ctx.managers[config['cluster']] = CephManager( + mon, + ctx=ctx, + logger=log.getChild('ceph_manager.' + config['cluster']), + cluster=config['cluster'], + ) + yield + @contextlib.contextmanager def create_rbd_pool(ctx, config): cluster_name = config['cluster'] @@ -1870,6 +1884,7 @@ def task(ctx, config): lambda: run_daemon(ctx=ctx, config=config, type_='mgr'), lambda: crush_setup(ctx=ctx, config=config), lambda: run_daemon(ctx=ctx, config=config, type_='osd'), + lambda: setup_manager(ctx=ctx, config=config), lambda: create_rbd_pool(ctx=ctx, config=config), lambda: run_daemon(ctx=ctx, config=config, type_='mds'), lambda: cephfs_setup(ctx=ctx, config=config), @@ -1877,17 +1892,6 @@ def task(ctx, config): ] with contextutil.nested(*subtasks): - first_mon = teuthology.get_first_mon(ctx, config, config['cluster']) - (mon,) = ctx.cluster.only(first_mon).remotes.keys() - if not hasattr(ctx, 'managers'): - ctx.managers = {} - ctx.managers[config['cluster']] = CephManager( - mon, - ctx=ctx, - logger=log.getChild('ceph_manager.' + config['cluster']), - cluster=config['cluster'], - ) - try: if config.get('wait-for-healthy', True): healthy(ctx=ctx, config=dict(cluster=config['cluster'])) -- 2.47.3