summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-06-23 09:35:52 +0530
committerKaushal M <kaushal@redhat.com>2014-07-25 03:23:44 -0700
commit35c6ca05d8ee0e1be1b67ac64d32c21b195aaeea (patch)
treeb8ded335e06ec1dc12b13e25d37475a093d039b3 /tests/bugs
parentfb730072c27c9ae1b99ff41dbff45e721017d543 (diff)
feature/snapshot : Interface to delete all snapshots belonging
to a system as-well-as to a particular volume. Problem : With the current design we can only delete a single snapshot. And the deletion of volume which contains snapshot is not allowed. Because of that user might be forced to delete all the snapshots manually before he is allowed to delete a volume. Solution: Following is the interface with which user can delete all the snapshots of a system or belonging to a particular volume. Syntax : gluster snapshot delete all *To delete all the snapshots present in a system Syntax : gluster snapshot delete volume <volname> *To deletes all the snapshot present in a volume specified. ======================================================================== Sample Output: Case 1 : Deleting a single snapshot. [root@snapshot-24 glusterfs]# gluster snapshot delete snap1 Deleting snap will erase all the information about the snap. Do you still want to continue? (y/n) y snapshot delete: snap1: snap removed successfully ----------------------------------------------------------------- Case 2 : Deleting all the snapshots in a Volume. [root@snapshot-24 glusterfs]# gluster snapshot delete volume vol1 Volume (vol1) contains 9 snapshot(s). Do you still want to continue and delete them? (y/n) y snapshot delete: snap2: snap removed successfully snapshot delete: snap3: snap removed successfully snapshot delete: snap4: snap removed successfully snapshot delete: snap5: snap removed successfully . . . ----------------------------------------------------------------- Case 3 : Deleting all the snapshots in a system. [root@snapshot-24 glusterfs]# gluster snapshot delete all System contains 4 snapshot(s). Do you still want to continue and delete them? (y/n) y snapshot delete: snap7: snap removed successfully snapshot delete: snap8: snap removed successfully snapshot delete: snap9: snap removed successfully snapshot delete: snap10: snap removed successfully ======================================================================== Change-Id: Ifec8e128ab2011cbbba208376b9c92cfbe7d8d71 BUG: 1112613 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/8162 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/bug-1087203.t61
-rw-r--r--tests/bugs/bug-1112613.t49
2 files changed, 62 insertions, 48 deletions
diff --git a/tests/bugs/bug-1087203.t b/tests/bugs/bug-1087203.t
index 585ecf440ac..e41d601fb66 100644
--- a/tests/bugs/bug-1087203.t
+++ b/tests/bugs/bug-1087203.t
@@ -5,50 +5,12 @@
. $(dirname $0)/../snapshot.rc
. $(dirname $0)/../cluster.rc
-function config_validate ()
-{
- local var=$1
- $CLI_1 snapshot config | grep "^$var" | sed 's/.*: //'
-}
-
-function snap_create ()
-{
- local limit=$1;
- local i=0
- while [ $i -lt $limit ]
- do
- $CLI_1 snapshot create snap$i ${V0}
- i=$[$i+1]
- done
-}
-
-function snap_delete ()
-{
- local limit=$1;
- local i=0
- while [ $i -lt $limit ]
- do
- $CLI_1 snapshot delete snap$i
- i=$[$i+1]
- done
-}
-
-function get_snap_count ()
-{
- $CLI_1 snapshot list | wc -l
-}
-
function get_volume_info ()
{
local var=$1
$CLI_1 volume info $V0 | grep "^$var" | sed 's/.*: //'
}
-function is_snapshot_present ()
-{
- $CLI_1 snapshot list
-}
-
cleanup;
TEST verify_lvm_version
@@ -94,7 +56,7 @@ TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 10
# Validating auto-delete feature
# Make sure auto-delete is disabled by default
-EXPECT 'disable' config_validate 'auto-delete'
+EXPECT 'disable' snap_config CLI_1 'auto-delete'
# Test for invalid value for auto-delete
TEST ! $CLI_1 snapshot config auto-delete test
@@ -103,36 +65,39 @@ TEST $CLI_1 snapshot config snap-max-hard-limit 6
TEST $CLI_1 snapshot config snap-max-soft-limit 50
# Create 4 snapshots
-TEST snap_create 4;
+snap_index=1
+snap_count=4
+TEST snap_create CLI_1 $V0 $snap_index $snap_count
# If auto-delete is disabled then oldest snapshot
# should not be deleted automatically.
-EXPECT '4' get_snap_count;
+EXPECT '4' get_snap_count CLI_1;
-TEST snap_delete 4;
+TEST snap_delete CLI_1 $snap_index $snap_count;
# After all those 4 snaps are deleted, There will not be any snaps present
-EXPECT 'No snapshots present' is_snapshot_present;
+EXPECT '0' get_snap_count CLI_1;
TEST $CLI_1 snapshot config auto-delete enable
+
# auto-delete is already enabled, Hence expect a failure.
TEST ! $CLI_1 snapshot config auto-delete on
# Testing other boolean values with auto-delete
TEST $CLI_1 snapshot config auto-delete off
-EXPECT 'off' config_validate 'auto-delete'
+EXPECT 'off' snap_config CLI_1 'auto-delete'
TEST $CLI_1 snapshot config auto-delete true
-EXPECT 'true' config_validate 'auto-delete'
+EXPECT 'true' snap_config CLI_1 'auto-delete'
# Try to create 4 snaps again, As auto-delete is enabled
# oldest snap should be deleted and snapcount should be 3
-TEST snap_create 4;
-EXPECT '3' get_snap_count;
+TEST snap_create CLI_1 $V0 $snap_index $snap_count;
+EXPECT '3' get_snap_count CLI_1;
TEST $CLI_1 snapshot config auto-delete disable
-EXPECT 'disable' config_validate 'auto-delete'
+EXPECT 'disable' snap_config CLI_1 'auto-delete'
cleanup;
diff --git a/tests/bugs/bug-1112613.t b/tests/bugs/bug-1112613.t
new file mode 100644
index 00000000000..17302eaa427
--- /dev/null
+++ b/tests/bugs/bug-1112613.t
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../snapshot.rc
+. $(dirname $0)/../cluster.rc
+
+cleanup;
+
+V1="patchy2"
+
+TEST verify_lvm_version;
+TEST launch_cluster 2
+TEST setup_lvm 2
+
+TEST $CLI_1 peer probe $H2
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
+
+TEST $CLI_1 volume create $V0 $H1:$L1
+TEST $CLI_1 volume start $V0
+TEST $CLI_1 volume create $V1 $H2:$L2
+TEST $CLI_1 volume start $V1
+
+# Create 3 snapshots for volume $V0
+snap_count=3
+snap_index=1
+TEST snap_create CLI_1 $V0 $snap_index $snap_count;
+
+# Create 3 snapshots for volume $V1
+snap_count=4
+snap_index=11
+TEST snap_create CLI_1 $V1 $snap_index $snap_count;
+
+EXPECT '3' get_snap_count CLI_1 $V0;
+EXPECT '4' get_snap_count CLI_1 $V1;
+EXPECT '7' get_snap_count CLI_1
+
+TEST $CLI_1 snapshot delete volume $V0
+EXPECT '0' get_snap_count CLI_1 $V0;
+EXPECT '4' get_snap_count CLI_1 $V1;
+EXPECT '4' get_snap_count CLI_1
+
+TEST $CLI_1 snapshot delete all
+EXPECT '0' get_snap_count CLI_1 $V0;
+EXPECT '0' get_snap_count CLI_1 $V1;
+EXPECT '0' get_snap_count CLI_1
+
+cleanup;
+