summaryrefslogtreecommitdiffstats
path: root/tests/basic
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-02-05 16:12:53 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-03-10 04:42:00 -0700
commit1ae8b4c33af175545d6afe99aeb7a21896960a35 (patch)
tree4e56f0a7b8d760e9ceaea39f1b4c0b863a754218 /tests/basic
parent8cdd272dcf277aa4148c57458cc5477a49b08383 (diff)
snapshot: append timestamp with snapname
Appending GMT time stamp with snapname by default. If no-timestamp flag is given during snapshot creation, then time stamp will not append with snapname; Initial consumer of this feature is Samba's Shadow Copy feature. This feature allows Windows user to get previous revisions of a file. For this feature to work snapshot names under .snaps folder (USS) should have timestamp in following format appended: @GMT-YYYY.MM.DD-hh.mm.ss PS: https://www.samba.org/samba/docs/man/manpages/vfs_shadow_copy2.8.html This format is configurable by Samba conf file. Due to a limitation in Windows directory access the exact format cannot be used by USS. Therefore we have modified the file format to: _GMT-YYYY.MM.DD-hh.mm.ss Snapshot scheduling feature also required to append timestamp to the snapshot name therefore timestamp is appended in snapshot creation itself instead of doing the changes in snapview server. More info: https://www.mail-archive.com/gluster-users@gluster.org/msg18895.html Change-Id: Idac24670948cf4c0fbe916ea6690e49cbc832d07 BUG: 1189473 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/9597 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/uss.t16
-rwxr-xr-xtests/basic/volume-snapshot.t27
2 files changed, 30 insertions, 13 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t
index 2de66a97f48..4465391245a 100644
--- a/tests/basic/uss.t
+++ b/tests/basic/uss.t
@@ -43,11 +43,11 @@ for i in {1..10} ; do echo "file" > $M0/file$i ; done
TEST $CLI snapshot config activate-on-create enable
-TEST $CLI snapshot create snap1 $V0;
+TEST $CLI snapshot create snap1 $V0 no-timestamp;
for i in {11..20} ; do echo "file" > $M0/file$i ; done
-TEST $CLI snapshot create snap2 $V0;
+TEST $CLI snapshot create snap2 $V0 no-timestamp;
mkdir $M0/dir1;
mkdir $M0/dir2;
@@ -55,13 +55,12 @@ mkdir $M0/dir2;
for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done
for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done
-TEST $CLI snapshot create snap3 $V0;
+TEST $CLI snapshot create snap3 $V0 no-timestamp;
for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done
for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done
-TEST $CLI snapshot create snap4 $V0;
-
+TEST $CLI snapshot create snap4 $V0 no-timestamp;
## Test that features.uss takes only options enable/disable and throw error for
## any other argument.
for i in {1..10}; do
@@ -81,7 +80,6 @@ TEST ls $M0/.snaps;
NUM_SNAPS=$(ls $M0/.snaps | wc -l);
TEST [ $NUM_SNAPS == 4 ]
-
TEST ls $M0/.snaps/snap1;
TEST ls $M0/.snaps/snap2;
TEST ls $M0/.snaps/snap3;
@@ -290,7 +288,7 @@ TEST fd_close $fd3;
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0
#test 131
-TEST $CLI snapshot create snap5 $V0
+TEST $CLI snapshot create snap5 $V0 no-timestamp
TEST ls $M0/.history;
function count_snaps
@@ -319,7 +317,7 @@ EXPECT_WITHIN 30 "5" count_snaps $M0;
echo "aaa" > $M0/aaa;
-TEST $CLI snapshot create snap6 $V0
+TEST $CLI snapshot create snap6 $V0 no-timestamp
TEST ls $M0/.history;
@@ -331,7 +329,7 @@ TEST rm -f $M0/aaa;
TEST $CLI snapshot delete snap6;
-TEST $CLI snapshot create snap6 $V0
+TEST $CLI snapshot create snap6 $V0 no-timestamp
TEST ls $M0/.history;
diff --git a/tests/basic/volume-snapshot.t b/tests/basic/volume-snapshot.t
index 46440d1a706..65ce54b0a26 100755
--- a/tests/basic/volume-snapshot.t
+++ b/tests/basic/volume-snapshot.t
@@ -19,15 +19,25 @@ function create_volumes() {
}
function create_snapshots() {
- $CLI_1 snapshot create ${V0}_snap ${V0}&
+ $CLI_1 snapshot create ${V0}_snap ${V0} no-timestamp &
PID_1=$!
- $CLI_1 snapshot create ${V1}_snap ${V1}&
+ $CLI_1 snapshot create ${V1}_snap ${V1} no-timestamp &
PID_2=$!
wait $PID_1 $PID_2
}
+function create_snapshots_with_timestamp() {
+ $CLI_1 snapshot create ${V0}_snap1 ${V0}&
+ PID_1=$!
+ $CLI_1 snapshot create ${V1}_snap1 ${V1}&
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+
function activate_snapshots() {
$CLI_1 snapshot activate ${V0}_snap &
PID_1=$!
@@ -49,10 +59,10 @@ function deactivate_snapshots() {
}
function delete_snapshots() {
- $CLI_1 snapshot delete ${V0}_snap &
+ $CLI_1 snapshot delete $1 &
PID_1=$!
- $CLI_1 snapshot delete ${V1}_snap &
+ $CLI_1 snapshot delete $2 &
PID_2=$!
wait $PID_1 $PID_2
@@ -114,6 +124,15 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
TEST glusterfs -s $H2 --volfile-id=/snaps/${V1}_snap/${V1} $M0
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+#create timestamp appended snaps
+create_snapshots_with_timestamp;
+new_name1=`$CLI_1 snapshot list ${V0} | grep ${V0}_snap1`;
+new_name2=`$CLI_1 snapshot list ${V1} | grep ${V1}_snap1`;
+
+EXPECT_NOT "{V0}_snap1" echo $new_name1;
+EXPECT_NOT "{V1}_snap1" echo $new_name1;
+delete_snapshots $new_name1 $new_name2;
+
#Clean up
stop_force_volumes 2
EXPECT 'Stopped' volinfo_field $V0 'Status';