7 from teuthology
.orchestra
import run
8 from teuthology
import misc
as teuthology
12 log
= logging
.getLogger(__name__
)
14 @contextlib.contextmanager
15 def task(ctx
, config
):
19 The config should be as follows:
22 clients: [client list]
23 time: <seconds to run>
25 size: write size to use
26 concurrency: max number of outstanding writes (16)
27 objectsize: object size to use
28 unique_pool: use a unique pool, defaults to False
29 ec_pool: create an ec pool, defaults to False
30 create_pool: create pool, defaults to True
32 name: teuthologyprofile
35 crush-failure-domain: osd
36 cleanup: false (defaults to true)
37 type: <write|seq|rand> (defaults to write)
47 log
.info('Beginning radosbench...')
48 assert isinstance(config
, dict), \
49 "please list clients to run on"
52 testdir
= teuthology
.get_testdir(ctx
)
53 manager
= ctx
.managers
['ceph']
54 runtype
= config
.get('type', 'write')
56 create_pool
= config
.get('create_pool', True)
57 for role
in config
.get('clients', ['client.0']):
58 assert isinstance(role
, six
.string_types
)
60 assert role
.startswith(PREFIX
)
61 id_
= role
[len(PREFIX
):]
62 (remote
,) = ctx
.cluster
.only(role
).remotes
.keys()
64 if config
.get('ec_pool', False):
65 profile
= config
.get('erasure_code_profile', {})
66 profile_name
= profile
.get('name', 'teuthologyprofile')
67 manager
.create_erasure_code_profile(profile_name
, profile
)
72 if not config
.get('cleanup', True):
73 cleanup
= ['--no-cleanup']
75 if config
.get('write-omap', False):
76 write_to_omap
= ['--write-omap']
77 log
.info('omap writes')
79 pool
= config
.get('pool', 'data')
82 manager
.create_pool(pool
, erasure_code_profile_name
=profile_name
)
84 pool
= manager
.create_pool_with_unique_name(erasure_code_profile_name
=profile_name
)
86 size
= config
.get('size', 65536)
87 concurrency
= config
.get('concurrency', 16)
88 osize
= config
.get('objectsize', 65536)
89 sizeargs
= ['-b', str(size
)]
90 if osize
!= 0 and osize
!= size
:
91 # only use -O if this varies from size. kludgey workaround the
92 # fact that -O was -o in older releases.
93 sizeargs
.extend(['-O', str(osize
)])
95 # If doing a reading run then populate data
96 if runtype
!= "write":
100 " ".join(['adjust-ulimits',
102 '{tdir}/archive/coverage',
104 '--no-log-to-stderr',
107 ['-t', str(concurrency
)] +
109 'bench', str(60), "write", "--no-cleanup"
110 ]).format(tdir
=testdir
),
112 logger
=log
.getChild('radosbench.{id}'.format(id=id_
)),
120 " ".join(['adjust-ulimits',
122 '{tdir}/archive/coverage',
124 '--no-log-to-stderr',
128 'bench', str(config
.get('time', 360)), runtype
,
129 ] + write_to_omap
+ cleanup
).format(tdir
=testdir
),
131 logger
=log
.getChild('radosbench.{id}'.format(id=id_
)),
135 radosbench
[id_
] = proc
140 timeout
= config
.get('time', 360) * 30 + 300
141 log
.info('joining radosbench (timing out after %ss)', timeout
)
142 run
.wait(radosbench
.values(), timeout
=timeout
)
144 if pool
!= 'data' and create_pool
:
145 manager
.remove_pool(pool
)