]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
initialize ctx.manager in ceph.py
authorLoic Dachary <loic@dachary.org>
Thu, 14 Aug 2014 22:46:36 +0000 (00:46 +0200)
committerLoic Dachary <loic@dachary.org>
Fri, 15 Aug 2014 13:56:35 +0000 (15:56 +0200)
instead of rados.py because ceph.py is only run once where rados.py
could be run multiple time, leading to race conditions

http://tracker.ceph.com/issues/9027 Fixes: #9027

Signed-off-by: Loic Dachary <loic@dachary.org>
tasks/ceph.py
tasks/rados.py

index a7f08d5134f80dd4ba3e02afb2f4fa67f36d13a1..07eb604ba9a02d237921efe805379264149369a7 100644 (file)
@@ -12,6 +12,7 @@ import os
 import json
 import time
 
+from ceph_manager import CephManager
 from teuthology import misc as teuthology
 from teuthology import contextutil
 from teuthology.orchestra import run
@@ -1227,6 +1228,13 @@ def task(ctx, config):
         try:
             if config.get('wait-for-healthy', True):
                 healthy(ctx=ctx, config=None)
+            first_mon = teuthology.get_first_mon(ctx, config)
+            (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
+            ctx.manager = CephManager(
+                mon,
+                ctx=ctx,
+                logger=log.getChild('ceph_manager'),
+            )
             yield
         finally:
             if config.get('wait-for-scrub', True):
index 3bc17cc8f5c6466132ef98c3c80b7cc1b904b3ac..570a6f4f2412c741fe0e1bfaf414ec7f8eeaeaf3 100644 (file)
@@ -4,7 +4,6 @@ Rados modle-based integration tests
 import contextlib
 import logging
 import gevent
-from ceph_manager import CephManager
 from teuthology import misc as teuthology
 
 from teuthology.orchestra import run
@@ -142,15 +141,6 @@ def task(ctx, config):
 
     def thread():
         """Thread spawned by gevent"""
-        first_mon = teuthology.get_first_mon(ctx, config)
-        (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
-        if not hasattr(ctx, 'manager'):
-            ctx.manager = CephManager(
-                mon,
-                ctx=ctx,
-                logger=log.getChild('ceph_manager'),
-                )
-
         clients = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
         log.info('clients are %s' % clients)
         if config.get('ec_pool', False):