From 2f4cb26d8bbd1457bc261547103b56ad40b3c464 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 7 Jul 2016 22:16:51 -0400 Subject: [PATCH] qa/workunits/rbd: exercise snapshot renames within rbd-mirror test Snapshot rename operations utilize the (cluster) unique snapshot sequence to prevent attempts at replays. When mirroring to a different cluster, these sequences will not align. Signed-off-by: Jason Dillaman --- qa/workunits/rbd/rbd_mirror.sh | 8 ++++++++ qa/workunits/rbd/rbd_mirror_helpers.sh | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/qa/workunits/rbd/rbd_mirror.sh b/qa/workunits/rbd/rbd_mirror.sh index 78978124a4d3c..f27b46f22910c 100755 --- a/qa/workunits/rbd/rbd_mirror.sh +++ b/qa/workunits/rbd/rbd_mirror.sh @@ -188,6 +188,14 @@ for i in ${image2} ${image4}; do compare_images ${POOL} ${i} done +testlog "TEST: snapshot rename" +snap_name='snap_rename' +create_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_0" +for i in `seq 1 20`; do + rename_snapshot ${CLUSTER2} ${POOL} ${image2} "${snap_name}_$(expr ${i} - 1)" "${snap_name}_${i}" +done +wait_for_snap_present ${CLUSTER1} ${POOL} ${image2} "${snap_name}_${i}" + testlog "TEST: disable mirror while daemon is stopped" stop_mirror ${CLUSTER1} stop_mirror ${CLUSTER2} diff --git a/qa/workunits/rbd/rbd_mirror_helpers.sh b/qa/workunits/rbd/rbd_mirror_helpers.sh index 307705eacda20..2c22327e1d7cd 100755 --- a/qa/workunits/rbd/rbd_mirror_helpers.sh +++ b/qa/workunits/rbd/rbd_mirror_helpers.sh @@ -529,6 +529,17 @@ remove_snapshot() rbd --cluster ${cluster} -p ${pool} snap rm ${image}@${snap} } +rename_snapshot() +{ + local cluster=$1 + local pool=$2 + local image=$3 + local snap=$4 + local new_snap=$5 + + rbd --cluster ${cluster} -p ${pool} snap rename ${image}@${snap} ${image}@${new_snap} +} + purge_snapshots() { local cluster=$1 -- 2.39.5