qa/workunits/rbd: add parent migration case

Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2019-02-07 10:12:07 +00:00
parent 3787432820
commit 5e951cd3ae

View File

@ -755,6 +755,50 @@ test_migration() {
expect_fail rbd trash restore $ID
rbd migration abort test1
# Migrate parent
rbd remove test1
dd if=/dev/urandom bs=1M count=1 | rbd --image-format 2 import - test1
md5sum=$(rbd export test1 - | md5sum)
rbd snap create test1@snap1
rbd snap protect test1@snap1
rbd snap create test1@snap2
rbd clone test1@snap1 clone_v1 --rbd_default_clone_format=1
rbd clone test1@snap2 clone_v2 --rbd_default_clone_format=2
rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
rbd info clone_v2 |grep 'op_features: clone-child'
test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
test "$(rbd children test1@snap1)" = "rbd/clone_v1"
test "$(rbd children test1@snap2)" = "rbd/clone_v2"
rbd migration prepare test1 rbd2/test2
rbd info clone_v1 | fgrep 'parent: rbd2/test2@snap1'
rbd info clone_v2 | fgrep 'parent: rbd2/test2@snap2'
rbd info clone_v2 | fgrep 'op_features: clone-child'
test "$(rbd children rbd2/test2@snap1)" = "rbd/clone_v1"
test "$(rbd children rbd2/test2@snap2)" = "rbd/clone_v2"
rbd migration execute test1
expect_fail rbd migration commit test1
rbd migration commit test1 --force
test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
rbd migration prepare rbd2/test2 test1
rbd info clone_v1 | fgrep 'parent: rbd/test1@snap1'
rbd info clone_v2 | fgrep 'parent: rbd/test1@snap2'
rbd info clone_v2 | fgrep 'op_features: clone-child'
test "$(rbd children test1@snap1)" = "rbd/clone_v1"
test "$(rbd children test1@snap2)" = "rbd/clone_v2"
rbd migration execute test1
expect_fail rbd migration commit test1
rbd migration commit test1 --force
test "$(rbd export clone_v1 - | md5sum)" = "${md5sum}"
test "$(rbd export clone_v2 - | md5sum)" = "${md5sum}"
rbd remove clone_v1
rbd remove clone_v2
rbd snap unprotect test1@snap1
rbd snap purge test1
rbd rm test1
for format in 1 2; do
# Abort migration after successful prepare
rbd create -s 128M --image-format ${format} test2