2 Rados modle-based integration tests
7 from teuthology
import misc
as teuthology
10 from teuthology
.orchestra
import run
12 log
= logging
.getLogger(__name__
)
14 @contextlib.contextmanager
15 def task(ctx
, config
):
17 Run RadosModel-based integration tests.
19 The config should be as follows::
22 clients: [client list]
24 objects: <number of objects to use>
25 max_in_flight: <max number of operations in flight>
26 object_size: <size of objects in bytes>
27 min_stride_size: <minimum write stride size in bytes>
28 max_stride_size: <maximum write stride size in bytes>
29 op_weights: <dictionary mapping operation type to integer weight>
30 runs: <number of times to run> - the pool is remade between runs
31 ec_pool: use an ec pool
32 erasure_code_profile: profile to use with the erasure coded pool
33 fast_read: enable ec_pool's fast_read
34 min_size: set the min_size of created pool
35 pool_snaps: use pool snapshots instead of selfmanaged snapshots
36 write_fadvise_dontneed: write behavior like with LIBRADOS_OP_FLAG_FADVISE_DONTNEED.
37 This mean data don't access in the near future.
38 Let osd backend don't keep data in cache.
47 max_seconds: 0 # 0 for no limit
60 ec_pool: create an ec pool, defaults to False
61 erasure_code_use_overwrites: test overwrites, default false
63 name: teuthologyprofile
66 crush-failure-domain: osd
68 write_fadvise_dontneed: true
72 Optionally, you can provide the pool name to run against:
78 - ceph osd pool create foo
84 Alternatively, you can provide a pool prefix:
90 - ceph osd pool create foo.client.0
96 The tests are run asynchronously, they are not complete when the task
97 returns. For instance:
109 - print: "**** done rados ec-cache-agent (part 2)"
111 will run the print task immediately after the rados tasks begins but
112 not after it completes. To make the rados task a blocking / sequential
126 - print: "**** done rados ec-cache-agent (part 2)"
129 log
.info('Beginning rados...')
130 assert isinstance(config
, dict), \
131 "please list clients to run on"
133 object_size
= int(config
.get('object_size', 4000000))
134 op_weights
= config
.get('op_weights', {})
135 testdir
= teuthology
.get_testdir(ctx
)
139 '{tdir}/archive/coverage'.format(tdir
=testdir
),
141 if config
.get('ec_pool', False):
142 args
.extend(['--no-omap'])
143 if not config
.get('erasure_code_use_overwrites', False):
144 args
.extend(['--ec-pool'])
145 if config
.get('write_fadvise_dontneed', False):
146 args
.extend(['--write-fadvise-dontneed'])
147 if config
.get('set_redirect', False):
148 args
.extend(['--set_redirect'])
149 if config
.get('set_chunk', False):
150 args
.extend(['--set_chunk'])
151 if config
.get('enable_dedup', False):
152 args
.extend(['--enable_dedup'])
153 if config
.get('low_tier_pool', None):
154 args
.extend(['--low_tier_pool', config
.get('low_tier_pool', None)])
155 if config
.get('dedup_chunk_size', False):
156 args
.extend(['--dedup_chunk_size', config
.get('dedup_chunk_size', None)] )
157 if config
.get('dedup_chunk_algo', False):
158 args
.extend(['--dedup_chunk_algo', config
.get('dedup_chunk_algo', None)])
159 if config
.get('pool_snaps', False):
160 args
.extend(['--pool-snaps'])
161 if config
.get('balance_reads', False):
162 args
.extend(['--balance-reads'])
163 if config
.get('localize_reads', False):
164 args
.extend(['--localize-reads'])
166 '--max-ops', str(config
.get('ops', 10000)),
167 '--objects', str(config
.get('objects', 500)),
168 '--max-in-flight', str(config
.get('max_in_flight', 16)),
169 '--size', str(object_size
),
170 '--min-stride-size', str(config
.get('min_stride_size', object_size
// 10)),
171 '--max-stride-size', str(config
.get('max_stride_size', object_size
// 5)),
172 '--max-seconds', str(config
.get('max_seconds', 0))
176 weights
['read'] = 100
177 weights
['write'] = 100
178 weights
['delete'] = 10
179 # Parallel of the op_types in test/osd/TestRados.cc
182 # write handled above
183 # delete handled above
207 if field
in op_weights
:
208 weights
[field
] = op_weights
[field
]
210 if config
.get('write_append_excl', True):
211 if 'write' in weights
:
212 weights
['write'] = weights
['write'] // 2
213 weights
['write_excl'] = weights
['write']
215 if 'append' in weights
:
216 weights
['append'] = weights
['append'] // 2
217 weights
['append_excl'] = weights
['append']
219 for op
, weight
in weights
.items():
221 '--op', op
, str(weight
)
226 """Thread spawned by gevent"""
227 clients
= ['client.{id}'.format(id=id_
) for id_
in teuthology
.all_roles_of_type(ctx
.cluster
, 'client')]
228 log
.info('clients are %s' % clients
)
229 manager
= ctx
.managers
['ceph']
230 if config
.get('ec_pool', False):
231 profile
= config
.get('erasure_code_profile', {})
232 profile_name
= profile
.get('name', 'teuthologyprofile')
233 manager
.create_erasure_code_profile(profile_name
, profile
)
236 for i
in range(int(config
.get('runs', '1'))):
237 log
.info("starting run %s out of %s", str(i
), config
.get('runs', '1'))
239 existing_pools
= config
.get('pools', [])
241 for role
in config
.get('clients', clients
):
242 assert isinstance(role
, str)
244 assert role
.startswith(PREFIX
)
245 id_
= role
[len(PREFIX
):]
247 pool
= config
.get('pool', None)
248 if not pool
and existing_pools
:
249 pool
= existing_pools
.pop()
251 pool
= manager
.create_pool_with_unique_name(
252 erasure_code_profile_name
=profile_name
,
253 erasure_code_use_overwrites
=
254 config
.get('erasure_code_use_overwrites', False)
256 created_pools
.append(pool
)
257 if config
.get('fast_read', False):
258 manager
.raw_cluster_cmd(
259 'osd', 'pool', 'set', pool
, 'fast_read', 'true')
260 min_size
= config
.get('min_size', None);
261 if min_size
is not None:
262 manager
.raw_cluster_cmd(
263 'osd', 'pool', 'set', pool
, 'min_size', str(min_size
))
265 (remote
,) = ctx
.cluster
.only(role
).remotes
.keys()
267 args
=["CEPH_CLIENT_ID={id_}".format(id_
=id_
)] + args
+
269 logger
=log
.getChild("rados.{id}".format(id=id_
)),
274 run
.wait(tests
.values())
276 for pool
in created_pools
:
277 manager
.wait_snap_trimming_complete(pool
);
278 manager
.remove_pool(pool
)
280 running
= gevent
.spawn(thread
)
285 log
.info('joining rados')