]> 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 <ldachary@redhat.com>
Tue, 12 May 2015 16:57:18 +0000 (18:57 +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>
(cherry picked from commit 9782465c872b25710af278c701e15078a3748d03)

Conflicts:
tasks/rados.py
        because  if not hasattr(ctx, 'manager'): was not at the same place

tasks/ceph.py
tasks/rados.py

index abc3653743cf334f89b8af30f8e86d6b2c1476d0..2abc11019d84e42dcdb770525ca757df780ade19 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
@@ -1184,6 +1185,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:
             osd_scrub_pgs(ctx, config)
index 6cc52bdaaf1d9727a4ffa380d0d2e1a7594e5a0c..3d44fdff1c3e76ae8a6bdf822b4372ed67e36127 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
@@ -118,15 +117,6 @@ def task(ctx, config):
 
     def thread():
         """Thread spawned by gevent"""
-        if not hasattr(ctx, 'manager'):
-            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'),
-                )
-
         clients = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
         log.info('clients are %s' % clients)
         for i in range(int(config.get('runs', '1'))):