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
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()
# 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()
# 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()
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)