MCPcopy Create free account
hub / github.com/ceph/ceph / test_objectstore

Function test_objectstore

qa/tasks/ceph_objectstore_tool.py:248–753  ·  view source on GitHub ↗
(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False)

Source from the content-addressed store, hash-verified

246
247
248def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False):
249 manager = ctx.managers['ceph']
250
251 osds = ctx.cluster.only(teuthology.is_type('osd'))
252
253 TEUTHDIR = teuthology.get_testdir(ctx)
254 DATADIR = os.path.join(TEUTHDIR, "ceph.data")
255 DATALINECOUNT = 10000
256 ERRORS = 0
257 NUM_OBJECTS = config.get('objects', 10)
258 log.info("objects: {num}".format(num=NUM_OBJECTS))
259
260 pool_dump = manager.get_pool_dump(REP_POOL)
261 REPID = pool_dump['pool']
262
263 log.debug("repid={num}".format(num=REPID))
264
265 db = {}
266
267 LOCALDIR = tempfile.mkdtemp("cod")
268
269 cod_setup_local_data(log, ctx, NUM_OBJECTS, LOCALDIR,
270 REP_NAME, DATALINECOUNT)
271 allremote = []
272 allremote.append(cli_remote)
273 allremote += list(osds.remotes.keys())
274 allremote = list(set(allremote))
275 for remote in allremote:
276 cod_setup_remote_data(log, ctx, remote, NUM_OBJECTS, DATADIR,
277 REP_NAME, DATALINECOUNT)
278
279 ERRORS += cod_setup(log, ctx, cli_remote, NUM_OBJECTS, DATADIR,
280 REP_NAME, DATALINECOUNT, REP_POOL, db, ec)
281
282 pgs = {}
283 for stats in manager.get_pg_stats():
284 if stats["pgid"].find(str(REPID) + ".") != 0:
285 continue
286 if pool_dump["type"] == ceph_manager.PoolType.REPLICATED:
287 for osd in stats["acting"]:
288 pgs.setdefault(osd, []).append(stats["pgid"])
289 elif pool_dump["type"] == ceph_manager.PoolType.ERASURE_CODED:
290 shard = 0
291 for osd in stats["acting"]:
292 pgs.setdefault(osd, []).append("{pgid}s{shard}".
293 format(pgid=stats["pgid"],
294 shard=shard))
295 shard += 1
296 else:
297 raise Exception("{pool} has an unexpected type {type}".
298 format(pool=REP_POOL, type=pool_dump["type"]))
299
300 log.info("Expected pgs: {_pgs}".format(_pgs=pgs))
301 log.info("Expected : {_db}".format(_db=db))
302
303 for osd in manager.get_osd_status()['up']:
304 manager.kill_osd(osd)
305 time.sleep(5)

Callers 1

taskFunction · 0.85

Calls 15

radosFunction · 0.90
cod_setup_local_dataFunction · 0.85
cod_setup_remote_dataFunction · 0.85
cod_setupFunction · 0.85
test_pg_infoFunction · 0.85
test_pg_loggingFunction · 0.85
test_pg_exportFunction · 0.85
test_pg_removalFunction · 0.85
test_pg_importFunction · 0.85
onlyMethod · 0.80
get_pool_dumpMethod · 0.80
get_osd_statusMethod · 0.80

Tested by

no test coverage detected