]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/blktrace: make cluster-aware
authorJosh Durgin <jdurgin@redhat.com>
Thu, 24 Mar 2016 00:50:39 +0000 (17:50 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Fri, 20 May 2016 18:08:53 +0000 (11:08 -0700)
Need to adjust to lookup devices by role rather than id, so might as
well add a cluster config option while we're at it. Remove the
confusing default config that is not actually used.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
(cherry picked from commit a3096e8600a4933d3420f9e498d0da7707eb686d)

tasks/blktrace.py

index 401f9e39f643175c6797cc121a863f6073ee1744..96aaf505ada53762f3da759cb2e901eba0d0edfd 100644 (file)
@@ -6,7 +6,7 @@ import logging
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
-from teuthology.orchestra import run 
+from teuthology.orchestra import run
 
 log = logging.getLogger(__name__)
 blktrace = '/usr/sbin/blktrace'
@@ -17,7 +17,7 @@ def setup(ctx, config):
     """
     Setup all the remotes
     """
-    osds = ctx.cluster.only(teuthology.is_type('osd'))
+    osds = ctx.cluster.only(teuthology.is_type('osd', config['cluster']))
     log_dir = '{tdir}/archive/performance/blktrace'.format(tdir=teuthology.get_testdir(ctx))
 
     for remote, roles_for_host in osds.remotes.iteritems():
@@ -40,9 +40,10 @@ def execute(ctx, config):
     osds = ctx.cluster.only(teuthology.is_type('osd'))
     for remote, roles_for_host in osds.remotes.iteritems():
         roles_to_devs = ctx.disk_config.remote_to_roles_to_dev[remote]
-        for id_ in teuthology.roles_of_type(roles_for_host, 'osd'):
-            if roles_to_devs.get(id_):
-                dev = roles_to_devs[id_]
+        for role in teuthology.cluster_roles_of_type(roles_for_host, 'osd',
+                                                     config['cluster']):
+            if roles_to_devs.get(role):
+                dev = roles_to_devs[role]
                 log.info("running blktrace on %s: %s" % (remote.name, dev))
 
                 proc = remote.run(
@@ -59,7 +60,7 @@ def execute(ctx, config):
                         '-d',
                         dev,
                         ],
-                    wait=False,   
+                    wait=False,
                     stdin=run.PIPE,
                     )
                 procs.append(proc)
@@ -76,18 +77,20 @@ def task(ctx, config):
     """
     Usage:
         blktrace:
-      
-    Runs blktrace on all clients.
+
+    or:
+        blktrace:
+          cluster: backup
+
+    Runs blktrace on all osds in the specified cluster (the 'ceph' cluster by
+    default).
     """
     if config is None:
-        config = dict(('client.{id}'.format(id=id_), None)
-                  for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client'))
-    elif isinstance(config, list):
-        config = dict.fromkeys(config)
+        config = {}
+    config['cluster'] = config.get('cluster', 'ceph')
 
     with contextutil.nested(
         lambda: setup(ctx=ctx, config=config),
         lambda: execute(ctx=ctx, config=config),
         ):
         yield
-