diff options
author | Mohammed Rafi KC <rkavunga@redhat.com> | 2015-02-23 17:28:47 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-18 00:07:55 -0700 |
commit | 260a6943849f99227248a8fc852a8c8fc3d1e289 (patch) | |
tree | cf8d81b9e89a855975434638ac89abac7cde4696 /tests/basic/volume-snapshot-clone.t | |
parent | c99c72b35fac16e08c4d170b6a46a786caaeef58 (diff) |
Snapshot/clone: clone of a snapshot that will act as a regular volume
snapshot clone will allow us to take a snpahot of a snapshot.
Newly created clone volume will be a regular volume with read/write
permissions.
CLI command
snapshot clone <clonename> <snapname>
Change-Id: Icadb993fa42fff787a330f8f49452da54e9db7de
BUG: 1199894
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: http://review.gluster.org/9750
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/basic/volume-snapshot-clone.t')
-rwxr-xr-x | tests/basic/volume-snapshot-clone.t | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/tests/basic/volume-snapshot-clone.t b/tests/basic/volume-snapshot-clone.t new file mode 100755 index 00000000000..b142804e51b --- /dev/null +++ b/tests/basic/volume-snapshot-clone.t @@ -0,0 +1,114 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../cluster.rc +. $(dirname $0)/../snapshot.rc + + +V1="patchy2" + +function create_volumes() { + $CLI_1 volume create $V0 $H1:$L1 & + PID_1=$! + + $CLI_2 volume create $V1 $H2:$L2 $H3:$L3 & + PID_2=$! + + wait $PID_1 $PID_2 +} + +function create_snapshots() { + + $CLI_1 snapshot create $1 $2 no-timestamp& + PID_1=$! + + wait $PID_1 +} + + + +function delete_snapshot() { + $CLI_1 snapshot delete $1 & + PID_1=$! + + wait $PID_1 +} + +cleanup; + +TEST verify_lvm_version; +#Create cluster with 3 nodes +TEST launch_cluster 3; +TEST setup_lvm 3 + +TEST $CLI_1 peer probe $H2; +TEST $CLI_1 peer probe $H3; +EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count; + +create_volumes +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT 'Created' volinfo_field $V1 'Status'; + +start_volumes 2 +EXPECT 'Started' volinfo_field $V0 'Status'; +EXPECT 'Started' volinfo_field $V1 'Status'; + +TEST $CLI_1 snapshot config activate-on-create enable + +#Snapshot Operations +create_snapshots ${V0}_snap ${V0}; +create_snapshots ${V1}_snap ${V1}; + +EXPECT 'Started' snapshot_status ${V0}_snap; +EXPECT 'Started' snapshot_status ${V1}_snap; + +sleep 5 +TEST $CLI_1 snapshot clone ${V0}_clone ${V0}_snap +TEST $CLI_1 snapshot clone ${V1}_clone ${V1}_snap + +EXPECT 'Created' volinfo_field ${V0}_clone 'Status'; +EXPECT 'Created' volinfo_field ${V1}_clone 'Status'; + +TEST $CLI_1 volume start ${V0}_clone force; +TEST $CLI_1 volume start ${V1}_clone force; + +EXPECT 'Started' volinfo_field ${V0}_clone 'Status'; +EXPECT 'Started' volinfo_field ${V1}_clone 'Status'; + + +TEST glusterfs -s $H1 --volfile-id=/${V0}_clone $M0 +TEST glusterfs -s $H2 --volfile-id=/${V1}_clone $M1 + +TEST touch $M0/file1 +TEST touch $M1/file1 + +TEST echo "Hello world" $M0/file1 +TEST echo "Hello world" $M1/file1 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1 + +TEST kill_glusterd 2; +TEST $glusterd_2; + +sleep 5 + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field ${V0}_clone 'Status'; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field ${V1}_clone 'Status'; +#Clean up +stop_force_volumes 2 +EXPECT 'Stopped' volinfo_field $V0 'Status'; +EXPECT 'Stopped' volinfo_field $V1 'Status'; + +TEST delete_snapshot ${V0}_snap +TEST delete_snapshot ${V1}_snap + +TEST ! snapshot_exists 1 ${V0}_snap +TEST ! snapshot_exists 1 ${V1}_snap + +delete_volumes 2 +TEST ! volume_exists $V0 +TEST ! volume_exists $V1 + +cleanup; |