From: zhengyin Date: Mon, 16 Mar 2020 08:52:55 +0000 (+0800) Subject: test: add test case for children's stripe X-Git-Tag: v16.1.0~2687^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f871eda28bf4e4b8dbc27dd6a77005405f7f222;p=ceph.git test: add test case for children's stripe Signed-off-by: Zheng Yin --- diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 1bd84e81f84..214a682fd20 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -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)