From 1a2700f4040e5f7cda8eb300d7bda1ef0a4ef6ed Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 27 Jun 2019 18:57:54 +0800 Subject: [PATCH] qa/tasks: extract {ERASURE_CODED,REPLICATED}_POOL out so they can be reused by `Thrasher`. Signed-off-by: Kefu Chai --- qa/tasks/ceph_manager.py | 10 ++++++---- qa/tasks/ceph_objectstore_tool.py | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index fc255cca48d..fff74aeb6bf 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -95,6 +95,11 @@ def mount_osd_data(ctx, remote, cluster, osd): ) +class PoolType: + REPLICATED = 1 + ERASURE_CODED = 3 + + class Thrasher: """ Object used to thrash Ceph @@ -1174,9 +1179,6 @@ class CephManager: the same name. """ - REPLICATED_POOL = 1 - ERASURE_CODED_POOL = 3 - def __init__(self, controller, ctx=None, config=None, logger=None, cluster='ceph'): self.lock = threading.RLock() @@ -2060,7 +2062,7 @@ class CephManager: """ pool_dump = self.get_pool_dump(pool) object_map = self.get_object_map(pool, name) - if pool_dump["type"] == CephManager.ERASURE_CODED_POOL: + if pool_dump["type"] == PoolType.ERASURE_CODED: shard = object_map['acting'].index(osdid) return "{pgid}s{shard}".format(pgid=object_map['pgid'], shard=shard) diff --git a/qa/tasks/ceph_objectstore_tool.py b/qa/tasks/ceph_objectstore_tool.py index 912577317b4..2caa6cdbce4 100644 --- a/qa/tasks/ceph_objectstore_tool.py +++ b/qa/tasks/ceph_objectstore_tool.py @@ -250,10 +250,10 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False): for stats in manager.get_pg_stats(): if stats["pgid"].find(str(REPID) + ".") != 0: continue - if pool_dump["type"] == ceph_manager.CephManager.REPLICATED_POOL: + if pool_dump["type"] == ceph_manager.PoolType.REPLICATED: for osd in stats["acting"]: pgs.setdefault(osd, []).append(stats["pgid"]) - elif pool_dump["type"] == ceph_manager.CephManager.ERASURE_CODED_POOL: + elif pool_dump["type"] == ceph_manager.PoolType.ERASURE_CODED: shard = 0 for osd in stats["acting"]: pgs.setdefault(osd, []).append("{pgid}s{shard}". @@ -311,7 +311,7 @@ def test_objectstore(ctx, config, cli_remote, REP_POOL, REP_NAME, ec=False): log.info(pgswithobjects) log.info(objsinpg) - if pool_dump["type"] == ceph_manager.CephManager.REPLICATED_POOL: + if pool_dump["type"] == ceph_manager.PoolType.REPLICATED: # Test get-bytes log.info("Test get-bytes and set-bytes") for basename in db.keys(): -- 2.39.5