From c4c7075029f20f238585145c464a8c972d9ad038 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Thu, 17 Aug 2017 09:58:18 +0200 Subject: [PATCH] qa/workunits/rbd: test data pool is mirrored correctly Signed-off-by: Mykola Golub --- qa/workunits/rbd/rbd_mirror.sh | 18 ++++++++++++++++++ qa/workunits/rbd/rbd_mirror_helpers.sh | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/qa/workunits/rbd/rbd_mirror.sh b/qa/workunits/rbd/rbd_mirror.sh index 021cbaf03f740..04a03a66e5cfc 100755 --- a/qa/workunits/rbd/rbd_mirror.sh +++ b/qa/workunits/rbd/rbd_mirror.sh @@ -216,6 +216,24 @@ compare_images ${POOL} ${clone_image} expect_failure "is non-primary" clone_image ${CLUSTER1} ${PARENT_POOL} \ ${parent_image} ${parent_snap} ${POOL} ${clone_image}1 +testlog "TEST: data pool" +dp_image=test_data_pool +create_image ${CLUSTER2} ${POOL} ${dp_image} 128 --data-pool ${PARENT_POOL} +data_pool=$(get_image_data_pool ${CLUSTER2} ${POOL} ${dp_image}) +test "${data_pool}" = "${PARENT_POOL}" +wait_for_image_replay_started ${CLUSTER1} ${POOL} ${dp_image} +data_pool=$(get_image_data_pool ${CLUSTER1} ${POOL} ${dp_image}) +test "${data_pool}" = "${PARENT_POOL}" +create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap1' +write_image ${CLUSTER2} ${POOL} ${dp_image} 100 +create_snapshot ${CLUSTER2} ${POOL} ${dp_image} 'snap2' +write_image ${CLUSTER2} ${POOL} ${dp_image} 100 +wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${dp_image} +wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${dp_image} 'up+replaying' 'master_position' +compare_images ${POOL} ${dp_image}@snap1 +compare_images ${POOL} ${dp_image}@snap2 +compare_images ${POOL} ${dp_image} + testlog "TEST: disable mirroring / delete non-primary image" image2=test2 image3=test3 diff --git a/qa/workunits/rbd/rbd_mirror_helpers.sh b/qa/workunits/rbd/rbd_mirror_helpers.sh index f825bec8549db..23216711e6ac3 100755 --- a/qa/workunits/rbd/rbd_mirror_helpers.sh +++ b/qa/workunits/rbd/rbd_mirror_helpers.sh @@ -867,6 +867,16 @@ request_resync_image() rbd --cluster=${cluster} -p ${pool} mirror image resync ${image} } +get_image_data_pool() +{ + local cluster=$1 + local pool=$2 + local image=$3 + + rbd --cluster ${cluster} -p ${pool} info ${image} | + awk '$1 == "data_pool:" {print $2}' +} + # # Main # -- 2.39.5