summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2014-04-14 19:18:41 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-02 09:27:46 -0700
commit0f56f0ce2d2e18fbb2eedf14e93b5a592f0005c3 (patch)
treee5cca809f024f8e31433bd5a8d22ae352b574a0e /tests
parentb189bb33edc2582e53923dec51bdef0f118c3d36 (diff)
glusterd/snapshot: Activation and De-activation of snapshot
Previously, snapshots by default were activated on creation and there was no option to activate or deactivate them on demand. This will allow the user to activate and deactivate on demand. The CLI goes as follows 1) Activate the snap using a command "gluster snapshot activate <snapname> [force]" 2) Deactivate the snap using a command "gluster snapshot deactivate <snapname>" Note: Even now the snapshot will be activated during creation. Change-Id: I0946d800780f26c63fa1fcaf29aabc900140448f BUG: 1061685 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/7476 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/basic/volume-snapshot.t34
-rwxr-xr-xtests/snapshot.rc13
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/basic/volume-snapshot.t b/tests/basic/volume-snapshot.t
index e6c47f0d527..30dfbbca195 100755
--- a/tests/basic/volume-snapshot.t
+++ b/tests/basic/volume-snapshot.t
@@ -28,6 +28,26 @@ function create_snapshots() {
wait $PID_1 $PID_2
}
+function activate_snapshots() {
+ $CLI_1 snapshot activate ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot activate ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+function deactivate_snapshots() {
+ $CLI_1 snapshot deactivate ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot deactivate ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
function delete_snapshots() {
$CLI_1 snapshot delete ${V0}_snap &
PID_1=$!
@@ -68,6 +88,20 @@ EXPECT 'Started' volinfo_field $V1 'Status';
#Snapshot Operations
create_snapshots
+
+EXPECT 'Started' snapshot_status ${V0}_snap;
+EXPECT 'Started' snapshot_status ${V1}_snap;
+
+deactivate_snapshots
+
+EXPECT 'Stopped' snapshot_status ${V0}_snap;
+EXPECT 'Stopped' snapshot_status ${V1}_snap;
+
+activate_snapshots
+
+EXPECT 'Started' snapshot_status ${V0}_snap;
+EXPECT 'Started' snapshot_status ${V1}_snap;
+
TEST snapshot_exists 1 ${V0}_snap
TEST snapshot_exists 1 ${V1}_snap
TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 100
diff --git a/tests/snapshot.rc b/tests/snapshot.rc
index 37c250344f1..a208fa3d410 100755
--- a/tests/snapshot.rc
+++ b/tests/snapshot.rc
@@ -286,6 +286,19 @@ function snapshot_n_exists() {
return $ret
}
+#Check for the status of snapshot for a volume
+#Arg1 : <Snap Name>
+function snapshot_status()
+{
+ local snap=$1;
+
+ #TODO: Right now just fetches the status of the single snap volume.
+ #When snapshot will have multiple snap volumes, should have a
+ #cummulative logic for status
+ $CLI_1 snapshot info $snap | grep "Status" | sed 's/.*: //';
+}
+
+
# TODO: Cleanup code duplication
function volinfo_field()
{