]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph: construct CephManager earlier
authorKefu Chai <kchai@redhat.com>
Mon, 11 Sep 2017 04:13:35 +0000 (12:13 +0800)
committerNathan Cutler <ncutler@suse.com>
Mon, 11 Sep 2017 15:07:46 +0000 (17:07 +0200)
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>
(cherry picked from commit c444db12d455a1901da8041e92f5eff1a9875170)

Conflicts:
qa/tasks/ceph.py: the `tasks` directory was moved into
`qa` after the cherry-picked change was merged.
so apply the change manually to the ceph.py
under `qa` directory.
(cherry picked from commit bc71dabb4e311bd2461489e98e9b95d5b635effc)

qa/tasks/ceph.py

index ec08457eaa433e280c0c7c09750f25058306986a..ec86ac81319517ab000ada4f93f07b1b86b4e7f7 100644 (file)
@@ -1512,19 +1512,19 @@ 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):