]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
thrashosds: make it work when first mon isn't mon.0
authorSage Weil <sage@newdream.net>
Wed, 31 Aug 2011 20:56:42 +0000 (13:56 -0700)
committerSage Weil <sage@newdream.net>
Thu, 1 Sep 2011 19:56:29 +0000 (12:56 -0700)
teuthology/misc.py
teuthology/task/ceph.py
teuthology/task/thrashosds.py

index ffb4f59dc1134070105ab71eb7a863bc4a7fe62d..d6fd80bbc17a7a18a8ff2814320c5f74749971c0 100644 (file)
@@ -362,3 +362,16 @@ def read_config(ctx):
         g = yaml.safe_load_all(f)
         for new in g:
             ctx.teuthology_config.update(new)
+
+# return the "first" mon (alphanumerically, for lack of anything better)
+def get_first_mon(ctx, config):
+    mons = []
+    for remote, roles in ctx.cluster.remotes.items():
+        for role in roles:
+            if not role.startswith('mon.'):
+                continue
+            mons.append(role)
+            break
+    firstmon = sorted(mons)[0]
+    assert firstmon
+    return firstmon
index 847aa07f23cb1d7df69a7b5844e86d258567621d..0a611d3791fe4f4f5ef50882037281fd4e10b52b 100644 (file)
@@ -207,19 +207,6 @@ def binaries(ctx, config):
                 ),
             )
 
-# return the "first" mon (alphanumerically, for lack of anything better)
-def get_first_mon(ctx, config):
-    mons = []
-    for remote, roles in ctx.cluster.remotes.items():
-        for role in roles:
-            if not role.startswith('mon.'):
-                continue
-            mons.append(role)
-            break
-    firstmon = sorted(mons)[0]
-    assert firstmon
-    return firstmon
-
 @contextlib.contextmanager
 def valgrind_post(ctx, config):
     try:
@@ -294,7 +281,7 @@ def cluster(ctx, config):
 
     coverage_dir = '/tmp/cephtest/archive/coverage'
 
-    firstmon = get_first_mon(ctx, config)
+    firstmon = teuthology.get_first_mon(ctx, config)
 
     log.info('Setting up %s...' % firstmon)
     ctx.cluster.only(firstmon).run(
@@ -710,7 +697,7 @@ def osd(ctx, config):
 @contextlib.contextmanager
 def mds(ctx, config):
     log.info('Starting mds daemons...')
-    firstmon = get_first_mon(ctx, config)
+    firstmon = teuthology.get_first_mon(ctx, config)
     mds_daemons = {}
     mdss = ctx.cluster.only(teuthology.is_type('mds'))
     coverage_dir = '/tmp/cephtest/archive/coverage'
@@ -783,7 +770,7 @@ def mds(ctx, config):
 
 def healthy(ctx, config):
     log.info('Waiting until ceph is healthy...')
-    firstmon = get_first_mon(ctx, config)
+    firstmon = teuthology.get_first_mon(ctx, config)
     (mon0_remote,) = ctx.cluster.only(firstmon).remotes.keys()
     teuthology.wait_until_healthy(
         remote=mon0_remote,
index 962a7ec9597f6a7471222c3ed5353ace5d987adc..4c76a5e9812674b681b9f9f68b43190dc93b1cde 100644 (file)
@@ -1,6 +1,8 @@
 import contextlib
 import logging
 import ceph_manager
+from teuthology import misc as teuthology
+
 
 log = logging.getLogger(__name__)
 
@@ -49,7 +51,8 @@ def task(ctx, config):
     - interactive:
     """
     log.info('Beginning thrashosds...')
-    (mon,) = ctx.cluster.only('mon.0').remotes.iterkeys()
+    first_mon = teuthology.get_first_mon(ctx, config)
+    (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()
     manager = ceph_manager.CephManager(
         mon,
         logger=log.getChild('ceph_manager'),