2011-06-13 17:29:22 +00:00
|
|
|
import contextlib
|
|
|
|
import logging
|
|
|
|
|
2011-09-13 21:53:02 +00:00
|
|
|
from ..orchestra import run
|
2013-01-23 20:37:39 +00:00
|
|
|
from teuthology import misc as teuthology
|
2011-06-13 17:29:22 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
@contextlib.contextmanager
|
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Run radosbench
|
|
|
|
|
|
|
|
The config should be as follows:
|
|
|
|
|
|
|
|
radosbench:
|
|
|
|
clients: [client list]
|
|
|
|
time: <seconds to run>
|
2012-07-19 22:49:29 +00:00
|
|
|
pool: <pool to use>
|
2011-06-13 17:29:22 +00:00
|
|
|
|
|
|
|
example:
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- ceph:
|
2011-07-12 01:00:03 +00:00
|
|
|
- radosbench:
|
2011-06-13 17:29:22 +00:00
|
|
|
clients: [client.0]
|
|
|
|
time: 360
|
|
|
|
- interactive:
|
|
|
|
"""
|
|
|
|
log.info('Beginning radosbench...')
|
|
|
|
assert isinstance(config, dict), \
|
|
|
|
"please list clients to run on"
|
|
|
|
radosbench = {}
|
|
|
|
|
2013-01-23 20:37:39 +00:00
|
|
|
testdir = teuthology.get_testdir(ctx)
|
|
|
|
|
2011-06-13 17:29:22 +00:00
|
|
|
for role in config.get('clients', ['client.0']):
|
|
|
|
assert isinstance(role, basestring)
|
|
|
|
PREFIX = 'client.'
|
|
|
|
assert role.startswith(PREFIX)
|
|
|
|
id_ = role[len(PREFIX):]
|
|
|
|
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
|
|
|
|
2012-07-19 22:49:29 +00:00
|
|
|
if config.get('pool', 'data') is not "data":
|
|
|
|
proc = remote.run(
|
|
|
|
args=[
|
|
|
|
"/bin/sh", "-c",
|
2013-02-06 19:16:52 +00:00
|
|
|
" ".join(['{tdir}/enable-coredump',
|
|
|
|
'ceph-coverage',
|
2013-01-23 20:37:39 +00:00
|
|
|
'{tdir}/archive/coverage',
|
2013-02-06 19:16:52 +00:00
|
|
|
'rados',
|
2012-07-19 22:49:29 +00:00
|
|
|
'--name', role,
|
|
|
|
'mkpool', str(config.get('pool', 'data'))
|
2013-01-23 20:37:39 +00:00
|
|
|
]).format(tdir=testdir),
|
2012-07-19 22:49:29 +00:00
|
|
|
],
|
|
|
|
logger=log.getChild('radosbench.{id}'.format(id=id_)),
|
|
|
|
stdin=run.PIPE,
|
|
|
|
wait=False
|
|
|
|
)
|
|
|
|
run.wait([proc])
|
|
|
|
|
2011-06-13 17:29:22 +00:00
|
|
|
proc = remote.run(
|
2011-07-12 01:00:03 +00:00
|
|
|
args=[
|
2011-06-13 17:29:22 +00:00
|
|
|
"/bin/sh", "-c",
|
2013-02-06 19:16:52 +00:00
|
|
|
" ".join(['{tdir}/enable-coredump',
|
|
|
|
'ceph-coverage',
|
2013-01-23 20:37:39 +00:00
|
|
|
'{tdir}/archive/coverage',
|
2013-02-06 19:16:52 +00:00
|
|
|
'rados',
|
2011-06-13 17:29:22 +00:00
|
|
|
'--name', role,
|
2012-07-19 22:49:29 +00:00
|
|
|
'-p' , str(config.get('pool', 'data')),
|
2011-06-13 17:29:22 +00:00
|
|
|
'bench', str(config.get('time', 360)), 'write',
|
2013-01-23 20:37:39 +00:00
|
|
|
]).format(tdir=testdir),
|
2011-06-13 17:29:22 +00:00
|
|
|
],
|
|
|
|
logger=log.getChild('radosbench.{id}'.format(id=id_)),
|
|
|
|
stdin=run.PIPE,
|
|
|
|
wait=False
|
|
|
|
)
|
|
|
|
radosbench[id_] = proc
|
|
|
|
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
|
|
|
log.info('joining radosbench')
|
|
|
|
run.wait(radosbench.itervalues())
|
2012-07-19 22:49:29 +00:00
|
|
|
|
|
|
|
if config.get('pool', 'data') is not "data":
|
|
|
|
proc = remote.run(
|
|
|
|
args=[
|
|
|
|
"/bin/sh", "-c",
|
2013-02-06 19:16:52 +00:00
|
|
|
" ".join(['{tdir}/enable-coredump',
|
|
|
|
'ceph-coverage',
|
2013-01-23 20:37:39 +00:00
|
|
|
'{tdir}/archive/coverage',
|
2013-02-06 19:16:52 +00:00
|
|
|
'rados',
|
2012-07-19 22:49:29 +00:00
|
|
|
'--name', role,
|
|
|
|
'rmpool', str(config.get('pool', 'data'))
|
2013-01-23 20:37:39 +00:00
|
|
|
]).format(tdir=testdir),
|
2012-07-19 22:49:29 +00:00
|
|
|
],
|
|
|
|
logger=log.getChild('radosbench.{id}'.format(id=id_)),
|
|
|
|
stdin=run.PIPE,
|
|
|
|
wait=False
|
|
|
|
)
|
|
|
|
run.wait([proc])
|