From: John Spray Date: Wed, 31 Aug 2016 14:31:31 +0000 (+0100) Subject: tasks/ceph: construct CephManager earlier X-Git-Tag: v11.1.1~58^2^2~106^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c444db12d455a1901da8041e92f5eff1a9875170;p=ceph.git tasks/ceph: construct CephManager earlier Previously, if errors occurred during healthy(), then the finally block would invoke osd_scrub_pgs, which relies on CephManager being constructed, and it would die, hiding the original exception. Signed-off-by: John Spray --- diff --git a/tasks/ceph.py b/tasks/ceph.py index 43735bea620..3c4b3f4accd 100644 --- a/tasks/ceph.py +++ b/tasks/ceph.py @@ -1485,19 +1485,21 @@ 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.iterkeys() + 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'])) - first_mon = teuthology.get_first_mon(ctx, config, config['cluster']) - (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys() - 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 finally: if config.get('wait-for-scrub', True):