From 6cc7ac4e2f29562953caa477a0ecd715977e1e16 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 28 Oct 2015 12:30:34 +0530 Subject: snapshot: Inherit snap-max-hard-limit from original volume Backport of http://review.gluster.org/#/c/12437/ A snapshot should inherit snap-max-hard-limit from the original volume while being created and when being restored to, it should restore the same. Similarly a clone taken from a snapshot should inherit snap-max-hard-limit from the snapshot. Change-Id: If8e90e2ffc10e22086b803ac8e2638a16bcec968 BUG: 1277390 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/12437 Tested-by: Gluster Build System Reviewed-by: mohammed rafi kc Tested-by: NetBSD Build System Reviewed-by: Rajesh Joseph (cherry picked from commit 1f74a3efbd0337759878ffff5cd4ee6782ddfe3f) Reviewed-on: http://review.gluster.org/12492 --- tests/bugs/snapshot/bug-1275616.t | 57 +++++++++++++++++++++++++++++++++++++++ tests/snapshot.rc | 16 +++++++++++ 2 files changed, 73 insertions(+) create mode 100755 tests/bugs/snapshot/bug-1275616.t (limited to 'tests') diff --git a/tests/bugs/snapshot/bug-1275616.t b/tests/bugs/snapshot/bug-1275616.t new file mode 100755 index 00000000000..cef07d6cd0b --- /dev/null +++ b/tests/bugs/snapshot/bug-1275616.t @@ -0,0 +1,57 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../snapshot.rc + +function get_snap_brick_status() +{ + local snap=$1; + + $CLI snapshot status $snap | grep "Brick Running" | sed 's/.*: //'; +} + +cleanup; +TEST verify_lvm_version; +TEST glusterd; +TEST pidof glusterd; + +TEST setup_lvm 1 + +TEST $CLI volume create $V0 $H0:$L1 +TEST $CLI volume start $V0 +TEST $CLI snapshot config activate-on-create enable + +TEST $CLI snapshot config $V0 snap-max-hard-limit 100 +TEST $CLI snapshot create snap1 $V0 no-timestamp + +TEST $CLI snapshot config $V0 snap-max-hard-limit 150 +TEST $CLI snapshot create snap2 $V0 no-timestamp + +TEST $CLI snapshot config $V0 snap-max-hard-limit 200 +TEST $CLI snapshot create snap3 $V0 no-timestamp +EXPECT '197' snap_info_volume CLI "Snaps Available" $V0; + +TEST $CLI volume stop $V0 + +# Restore the snapshots and verify the snap-max-hard-limit +# and the Snaps Available +TEST $CLI snapshot restore snap1 +EXPECT '98' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '100' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +TEST $CLI snapshot restore snap2 +EXPECT '149' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '150' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Yes" get_snap_brick_status snap3 + +#Take a clone and verify it inherits snapshot's snap-max-hard-limit +TEST $CLI snapshot clone clone1 snap3 + +EXPECT '149' snap_info_volume CLI "Snaps Available" $V0; +EXPECT '150' snap_config_volume CLI 'snap-max-hard-limit' $V0 + +EXPECT '200' snap_info_volume CLI "Snaps Available" clone1 +EXPECT '200' snap_config_volume CLI 'snap-max-hard-limit' clone1 + +cleanup; diff --git a/tests/snapshot.rc b/tests/snapshot.rc index 42f1b5c65a6..52ad86a3ec3 100644 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -431,6 +431,22 @@ function uss_count_snap_displayed() { ls $path/.snaps | wc -l } +function snap_info_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot info volume $vol | grep "^$var" | sed 's/.*: //' +} + +function snap_config_volume() +{ + eval local cli_index=\$$1 + local var=$2 + local vol=$3 + $cli_index snapshot config $vol| grep "^$var" | sed 's/.*: //' +} + #return specific fields of xml output function get-cmd-field-xml() { -- cgit