7 from teuthology
.orchestra
import run
8 from teuthology
import misc
as teuthology
10 log
= logging
.getLogger(__name__
)
12 @contextlib.contextmanager
13 def task(ctx
, config
):
17 The config should be as follows:
20 clients: [client list]
21 time: <seconds to run>
23 size: write size to use
24 unique_pool: use a unique pool, defaults to False
25 ec_pool: create an ec pool, defaults to False
26 create_pool: create pool, defaults to False
28 name: teuthologyprofile
31 ruleset-failure-domain: osd
32 cleanup: false (defaults to true)
42 log
.info('Beginning radosbench...')
43 assert isinstance(config
, dict), \
44 "please list clients to run on"
47 testdir
= teuthology
.get_testdir(ctx
)
48 manager
= ctx
.managers
['ceph']
50 create_pool
= config
.get('create_pool', True)
51 for role
in config
.get('clients', ['client.0']):
52 assert isinstance(role
, basestring
)
54 assert role
.startswith(PREFIX
)
55 id_
= role
[len(PREFIX
):]
56 (remote
,) = ctx
.cluster
.only(role
).remotes
.iterkeys()
58 if config
.get('ec_pool', False):
59 profile
= config
.get('erasure_code_profile', {})
60 profile_name
= profile
.get('name', 'teuthologyprofile')
61 manager
.create_erasure_code_profile(profile_name
, profile
)
66 if not config
.get('cleanup', True):
67 cleanup
= ['--no-cleanup']
69 pool
= config
.get('pool', 'data')
72 manager
.create_pool(pool
, erasure_code_profile_name
=profile_name
)
74 pool
= manager
.create_pool_with_unique_name(erasure_code_profile_name
=profile_name
)
79 " ".join(['adjust-ulimits',
81 '{tdir}/archive/coverage',
85 '-b', str(config
.get('size', 4<<20)),
87 'bench', str(config
.get('time', 360)), 'write',
88 ] + cleanup
).format(tdir
=testdir
),
90 logger
=log
.getChild('radosbench.{id}'.format(id=id_
)),
94 radosbench
[id_
] = proc
99 timeout
= config
.get('time', 360) * 5 + 180
100 log
.info('joining radosbench (timing out after %ss)', timeout
)
101 run
.wait(radosbench
.itervalues(), timeout
=timeout
)
103 if pool
is not 'data' and create_pool
:
104 manager
.remove_pool(pool
)