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 objectsize: object size to use
25 unique_pool: use a unique pool, defaults to False
26 ec_pool: create an ec pool, defaults to False
27 create_pool: create pool, defaults to True
29 name: teuthologyprofile
32 crush-failure-domain: osd
33 cleanup: false (defaults to true)
34 type: <write|seq|rand> (defaults to write)
44 log
.info('Beginning radosbench...')
45 assert isinstance(config
, dict), \
46 "please list clients to run on"
49 testdir
= teuthology
.get_testdir(ctx
)
50 manager
= ctx
.managers
['ceph']
51 runtype
= config
.get('type', 'write')
53 create_pool
= config
.get('create_pool', True)
54 for role
in config
.get('clients', ['client.0']):
55 assert isinstance(role
, basestring
)
57 assert role
.startswith(PREFIX
)
58 id_
= role
[len(PREFIX
):]
59 (remote
,) = ctx
.cluster
.only(role
).remotes
.iterkeys()
61 if config
.get('ec_pool', False):
62 profile
= config
.get('erasure_code_profile', {})
63 profile_name
= profile
.get('name', 'teuthologyprofile')
64 manager
.create_erasure_code_profile(profile_name
, profile
)
69 if not config
.get('cleanup', True):
70 cleanup
= ['--no-cleanup']
72 pool
= config
.get('pool', 'data')
75 manager
.create_pool(pool
, erasure_code_profile_name
=profile_name
)
77 pool
= manager
.create_pool_with_unique_name(erasure_code_profile_name
=profile_name
)
79 osize
= config
.get('objectsize', 0)
83 objectsize
= ['-o', str(osize
)]
84 size
= ['-b', str(config
.get('size', 4<<20))]
85 # If doing a reading run then populate data
86 if runtype
!= "write":
90 " ".join(['adjust-ulimits',
92 '{tdir}/archive/coverage',
98 'bench', str(60), "write", "--no-cleanup"
99 ]).format(tdir
=testdir
),
101 logger
=log
.getChild('radosbench.{id}'.format(id=id_
)),
110 " ".join(['adjust-ulimits',
112 '{tdir}/archive/coverage',
114 '--no-log-to-stderr',
116 + size
+ objectsize
+
118 'bench', str(config
.get('time', 360)), runtype
,
119 ] + cleanup
).format(tdir
=testdir
),
121 logger
=log
.getChild('radosbench.{id}'.format(id=id_
)),
125 radosbench
[id_
] = proc
130 timeout
= config
.get('time', 360) * 30 + 300
131 log
.info('joining radosbench (timing out after %ss)', timeout
)
132 run
.wait(radosbench
.itervalues(), timeout
=timeout
)
134 if pool
is not 'data' and create_pool
:
135 manager
.remove_pool(pool
)