From 7ad5cebae16dd725547df3c30558974f0825d262 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Tue, 21 May 2013 10:05:03 -0500 Subject: [PATCH] rbd image_read.sh: add clone-of-clone testing Add testing to verify that a snapshot of a clone and a clone of that snapshot both produce the correct results when read. Signed-off-by: Alex Elder --- qa/workunits/rbd/image_read.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/qa/workunits/rbd/image_read.sh b/qa/workunits/rbd/image_read.sh index 6fbe0c92bae59..11ec67705329d 100755 --- a/qa/workunits/rbd/image_read.sh +++ b/qa/workunits/rbd/image_read.sh @@ -31,7 +31,9 @@ # # Clone functionality is tested as well, in which case a clone is # made of the snapshot, and the same ranges of data are again read -# and compared with the original. +# and compared with the original. In addition, a snapshot of that +# clone is created, and a clone of *that* snapshot is put through +# the same set of tests. (Clone testing can be optionally skipped.) ################################################################ @@ -56,6 +58,8 @@ PROGNAME=$(basename $0) ORIGINAL=original-$$ SNAP1=snap1-$$ CLONE1=clone1-$$ +SNAP2=snap2-$$ +CLONE2=clone2-$$ function err() { if [ $# -gt 0 ]; then @@ -211,20 +215,38 @@ function setup() { sudo chown ubuntu /sys/bus/rbd/add sudo chown ubuntu /sys/bus/rbd/remove fi + # create and fill the original image with some data create_image "${ORIGINAL}" map_image "${ORIGINAL}" fill_original + + # create a snapshot of the original create_image_snap "${ORIGINAL}" "${SNAP1}" map_image_snap "${ORIGINAL}" "${SNAP1}" if [ "${TEST_CLONES}" = true ]; then + # create a clone of the original snapshot create_snap_clone "${ORIGINAL}" "${SNAP1}" "${CLONE1}" map_image "${CLONE1}" + + # create a snapshot of that clone + create_image_snap "${CLONE1}" "${SNAP2}" + map_image_snap "${CLONE1}" "${SNAP2}" + + # create a clone of that clone's snapshot + create_snap_clone "${CLONE1}" "${SNAP2}" "${CLONE2}" + map_image "${CLONE2}" fi } function teardown() { verbose "===== cleaning up =====" if [ "${TEST_CLONES}" = true ]; then + unmap_image "${CLONE2}" || true + destroy_snap_clone "${CLONE1}" "${SNAP2}" "${CLONE2}" || true + + unmap_image_snap "${CLONE1}" "${SNAP2}" || true + destroy_image_snap "${CLONE1}" "${SNAP2}" || true + unmap_image "${CLONE1}" || true destroy_snap_clone "${ORIGINAL}" "${SNAP1}" "${CLONE1}" || true fi @@ -608,6 +630,8 @@ run_using "${ORIGINAL}" doit "${ORIGINAL}@${SNAP1}" if [ "${TEST_CLONES}" = true ]; then doit "${CLONE1}" + doit "${CLONE1}@${SNAP2}" + doit "${CLONE2}" fi rm -rf $(out_data_dir "${ORIGINAL}") -- 2.39.5