From bd38426958fb27879bc1a06cf7104e94c7789796 Mon Sep 17 00:00:00 2001 From: Joseph Fernandes Date: Wed, 12 Feb 2014 13:03:30 +0530 Subject: Snapshot: snap-max-limit implemented Added the check on snap-max-limit in snapshot_create_prevalidate. Now snapshot creation will fail if snap count reaches max limit. Change-Id: I5b1cf8441f02c32085d2f6f5fd8902cb61031af5 BUG: 1049834 Author: Joseph Fernandes Signed-off-by: Joseph Fernandes Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/6981 Reviewed-by: Raghavendra Bhat --- tests/snapshot.rc | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'tests/snapshot.rc') diff --git a/tests/snapshot.rc b/tests/snapshot.rc index 0be98dc06..230f62a68 100755 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -175,3 +175,74 @@ function snapshot_exists() { $CLI snapshot list | egrep -q "\s$snapname\b" return $? } + +#Create N number of snaps in a given volume +#Arg1 : +#Arg2 : +#Arg3 : +#Return: Returns 0 if all snaps are created , +# if not will return exit code of last failed +# snap create command. +function create_n_snapshots() { + local vol=$1 + local snap_count=$2 + local snap_name=$3 + local ret=0 + for i in `seq 1 $snap_count`; do + $CLI_1 snapshot create ${vol} -n $snap_name$i & + PID_1=$! + wait $PID_1 + ret=$? + if [ "$ret" != "0" ]; then + break + fi + done + return $ret +} + + +#Delete N number of snaps in a given volume +#Arg1 : +#Arg2 : +#Arg3 : +#Return: Returns 0 if all snaps are Delete, +# if not will return exit code of last failed +# snap delete command. +function delete_n_snapshots() { + local vol=$1 + local snap_count=$2 + local snap_name=$3 + local ret=0 + for i in `seq 1 $snap_count`; do + $CLI_1 snapshot delete ${vol} -s $snap_name$i & + PID_1=$! + wait $PID_1 + temp=$? + if [ "$temp" != "0" ]; then + ret=$temp + fi + done + return $ret +} + +#Check for the existance of N number of snaps in a given volume +#Arg1 : +#Arg2 : +#Arg3 : +#Return: Returns 0 if all snaps exists, +# if not will return exit code of last failed +# snapshot_exists(). +function snapshot_n_exists() { + local vol=$1 + local snap_count=$2 + local snap_name=$3 + local ret=0 + for i in `seq 1 $snap_count`; do + snapshot_exists $snap_name$i + ret=$? + if [ "$ret" != "0" ]; then + break + fi + done + return $ret +} -- cgit