From 859cdebc2d2b425fd76f46d598ad59933396b279 Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Tue, 21 Oct 2014 07:57:22 +0530 Subject: USS : Display only the activated snapshots. Instead of displaying all the snapshots in the uss world, it is better if we display only the activated snapshots. Change-Id: I70d3ec212b62ec15956ae3e826bc4201d8dedd17 BUG: 1170548 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/8958 Tested-by: Gluster Build System Reviewed-by: Avra Sengupta Reviewed-by: Rajesh Joseph Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/9242 Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Raghavendra Bhat --- tests/bugs/bug-1045333.t | 1 - ...ug-1170548-dont-display-deactivated-snapshots.t | 36 ++++++++++++++++++++++ tests/snapshot.rc | 16 ++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/bug-1170548-dont-display-deactivated-snapshots.t (limited to 'tests') diff --git a/tests/bugs/bug-1045333.t b/tests/bugs/bug-1045333.t index d877d14c204..cfba8429642 100755 --- a/tests/bugs/bug-1045333.t +++ b/tests/bugs/bug-1045333.t @@ -13,7 +13,6 @@ TEST setup_lvm 1 TEST $CLI volume create $V0 $H0:$L1 TEST $CLI volume start $V0 - S1="${V0}-snap1" #Create snapshot with name contains hyphen(-) S2="-${V0}-snap2" #Create snapshot with name starts with hyphen(-) #Create snapshot with a long name diff --git a/tests/bugs/bug-1170548-dont-display-deactivated-snapshots.t b/tests/bugs/bug-1170548-dont-display-deactivated-snapshots.t new file mode 100644 index 00000000000..4c2e568ae4d --- /dev/null +++ b/tests/bugs/bug-1170548-dont-display-deactivated-snapshots.t @@ -0,0 +1,36 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../snapshot.rc + +cleanup; + +TEST init_n_bricks 2 +TEST setup_lvm 2 +TEST glusterd; + +TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 +TEST $CLI volume start $V0 + +# enable uss and mount the volume +TEST $CLI volume set $V0 features.uss enable +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0 + +# create 10 snapshots and check if all are being reflected +# in the USS world +TEST gluster snapshot config activate-on-create enable +for i in {1..10}; do $CLI snapshot create snap$i $V0; done +EXPECT 10 uss_count_snap_displayed $M0 + +# snapshots should not be displayed after deactivation +for i in {1..10}; do $CLI snapshot deactivate snap$i --mode=script; done +EXPECT 0 uss_count_snap_displayed $M0 + +# activate all the snapshots and check if all the activated snapshots +# are displayed again +for i in {1..10}; do $CLI snapshot activate snap$i --mode=script; done +EXPECT 10 uss_count_snap_displayed $M0 + +cleanup; + diff --git a/tests/snapshot.rc b/tests/snapshot.rc index 16549ec249f..175344ef5f7 100755 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -394,3 +394,19 @@ function check_if_snapd_exist() { pid=$(ps aux | grep "snapd" | grep -v grep | awk '{print $2}') if [ -n "$pid" ]; then echo "Y"; else echo "N"; fi } + +# returns number of snapshot being displayed in ".snaps" directory +function uss_count_snap_displayed() { + local path=$1 + ls $path/.snaps | wc -l +} + +case $OSTYPE in +NetBSD) + echo "Skip test on LVM which is not available on NetBSD" >&2 + SKIP_TESTS + exit 0 + ;; +*) + ;; +esac -- cgit