]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/blktrace.py
2 Run blktrace program through teuthology
7 from teuthology
import misc
as teuthology
8 from teuthology
import contextutil
9 from teuthology
.orchestra
import run
11 log
= logging
.getLogger(__name__
)
12 blktrace
= '/usr/sbin/blktrace'
13 daemon_signal
= 'term'
15 @contextlib.contextmanager
16 def setup(ctx
, config
):
20 osds
= ctx
.cluster
.only(teuthology
.is_type('osd', config
['cluster']))
21 log_dir
= '{tdir}/archive/performance/blktrace'.format(tdir
=teuthology
.get_testdir(ctx
))
23 for remote
, roles_for_host
in osds
.remotes
.items():
24 log
.info('Creating %s on %s' % (log_dir
, remote
.name
))
26 args
=['mkdir', '-p', '-m0755', '--', log_dir
],
31 @contextlib.contextmanager
32 def execute(ctx
, config
):
34 Run the blktrace program on remote machines.
37 testdir
= teuthology
.get_testdir(ctx
)
38 log_dir
= '{tdir}/archive/performance/blktrace'.format(tdir
=testdir
)
40 osds
= ctx
.cluster
.only(teuthology
.is_type('osd'))
41 for remote
, roles_for_host
in osds
.remotes
.items():
42 roles_to_devs
= ctx
.disk_config
.remote_to_roles_to_dev
[remote
]
43 for role
in teuthology
.cluster_roles_of_type(roles_for_host
, 'osd',
45 if roles_to_devs
.get(role
):
46 dev
= roles_to_devs
[role
]
47 log
.info("running blktrace on %s: %s" % (remote
.name
, dev
))
59 dev
.rsplit("/", 1)[1],
70 osds
= ctx
.cluster
.only(teuthology
.is_type('osd'))
71 log
.info('stopping blktrace processs')
75 @contextlib.contextmanager
76 def task(ctx
, config
):
85 Runs blktrace on all osds in the specified cluster (the 'ceph' cluster by
90 config
['cluster'] = config
.get('cluster', 'ceph')
92 with contextutil
.nested(
93 lambda: setup(ctx
=ctx
, config
=config
),
94 lambda: execute(ctx
=ctx
, config
=config
),