]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: extract {ERASURE_CODED,REPLICATED}_POOL out
authorKefu Chai <kchai@redhat.com>
Thu, 27 Jun 2019 10:57:54 +0000 (18:57 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 27 Jun 2019 11:00:23 +0000 (19:00 +0800)
so they can be reused by `Thrasher`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/ceph_manager.py
qa/tasks/ceph_objectstore_tool.py

index fc255cca48d33810535cce1adcc07cb4c8dfe79d..fff74aeb6bf1c1e4f4bff0fd73877daaf12727f6 100644 (file)
@@ -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)
index 912577317b40277cd6f0e8118246cd57d394b562..2caa6cdbce46b7a51a4d71fcf390e9862c1cb072 100644 (file)
@@ -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():