]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph: construct CephManager earlier
authorJohn Spray <john.spray@redhat.com>
Wed, 31 Aug 2016 14:31:31 +0000 (15:31 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 31 Aug 2016 14:32:33 +0000 (15:32 +0100)
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 <john.spray@redhat.com>
tasks/ceph.py

index 43735bea620c4557d843a55afd1326a35d88fb57..3c4b3f4accd16cf454a7be4136ce66bb87298d42 100644 (file)
@@ -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):