]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add test case for children's stripe
authorzhengyin <zhengyin@cmss.chinamoblie.com>
Mon, 16 Mar 2020 08:52:55 +0000 (16:52 +0800)
committerzhengyin <zhengyin@cmss.chinamoblie.com>
Sat, 28 Mar 2020 03:34:40 +0000 (11:34 +0800)
Signed-off-by: Zheng Yin <zhengyin@cmss.chinamobile.com>
src/test/pybind/test_rbd.py

index 1bd84e81f84ad45403d2308a08888c4cd2840883..214a682fd2045951def23b0251d16ec87b5306e7 100644 (file)
@@ -1372,6 +1372,30 @@ class TestClone(object):
                                self.image.stripe_unit(),
                                self.image.stripe_count())
 
+    def test_stripe_unit_and_count(self):
+        global features
+        global ioctx
+        image_name = get_temp_image_name()
+        RBD().create(ioctx, image_name, IMG_SIZE, IMG_ORDER, old_format=False,
+                     features=int(features), stripe_unit=1048576, stripe_count=8)
+        image = Image(ioctx, image_name)
+        image.create_snap('snap1')
+        image.protect_snap('snap1')
+        clone_name = get_temp_image_name()
+        RBD().clone(ioctx, image_name, 'snap1', ioctx, clone_name)
+        clone = Image(ioctx, clone_name)
+
+        eq(1048576, clone.stripe_unit())
+        eq(8, clone.stripe_count())
+
+        clone.close()
+        RBD().remove(ioctx, clone_name)
+        image.unprotect_snap('snap1')
+        image.remove_snap('snap1')
+        image.close()
+        RBD().remove(ioctx, image_name)
+
+
     def test_unprotected(self):
         self.image.create_snap('snap2')
         global features
@@ -1593,12 +1617,13 @@ class TestClone(object):
         assert_raises(ReadOnlyImage, self.clone.flatten)
         self.clone.remove_snap('snap2')
 
-    def check_flatten_with_order(self, new_order):
+    def check_flatten_with_order(self, new_order, stripe_unit=None,
+                                 stripe_count=None):
         global ioctx
         global features
         clone_name2 = get_temp_image_name()
         self.rbd.clone(ioctx, image_name, 'snap1', ioctx, clone_name2,
-                       features, new_order)
+                       features, new_order, stripe_unit, stripe_count)
         #with Image(ioctx, 'clone2') as clone:
         clone2 = Image(ioctx, clone_name2)
         clone2.flatten()
@@ -1608,7 +1633,7 @@ class TestClone(object):
 
         # flatten after resizing to non-block size
         self.rbd.clone(ioctx, image_name, 'snap1', ioctx, clone_name2,
-                       features, new_order)
+                       features, new_order, stripe_unit, stripe_count)
         with Image(ioctx, clone_name2) as clone:
             clone.resize(IMG_SIZE // 2 - 1)
             clone.flatten()
@@ -1617,7 +1642,7 @@ class TestClone(object):
 
         # flatten after resizing to non-block size
         self.rbd.clone(ioctx, image_name, 'snap1', ioctx, clone_name2,
-                       features, new_order)
+                       features, new_order, stripe_unit, stripe_count)
         with Image(ioctx, clone_name2) as clone:
             clone.resize(IMG_SIZE // 2 + 1)
             clone.flatten()
@@ -1628,7 +1653,7 @@ class TestClone(object):
         self.check_flatten_with_order(IMG_ORDER)
 
     def test_flatten_smaller_order(self):
-        self.check_flatten_with_order(IMG_ORDER - 2)
+        self.check_flatten_with_order(IMG_ORDER - 2, 1048576, 1)
 
     def test_flatten_larger_order(self):
         self.check_flatten_with_order(IMG_ORDER + 2)