diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-06-09 18:33:21 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2014-06-12 01:56:01 -0700 |
commit | 604ba9abf377ff56bb671478386d4ab977fdcd57 (patch) | |
tree | 43cfc3b732b1b9d74fc3dfdb747e13e8af2bd441 | |
parent | d240958fb36e652a2b910fe79414fb8b934e6158 (diff) |
mgmt/glusterd: provide interface for configuring the entry point to snapshots
Change-Id: Ibfd0e43db8e5f3f0f2ab6ec6bed88f71397c0bf4
BUG: 1107531
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/8025
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
-rw-r--r-- | tests/basic/uss.t | 99 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 12 |
2 files changed, 109 insertions, 2 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t index 44589f45b59..5f48ad2e9e5 100644 --- a/tests/basic/uss.t +++ b/tests/basic/uss.t @@ -56,6 +56,7 @@ TEST umount $M0; TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; +# test 15 TEST ls $M0/.snaps; NUM_SNAPS=$(ls $M0/.snaps | wc -l); @@ -105,6 +106,7 @@ TEST fd_close $fd3 # similar tests on nfs mount +# test 44 TEST mount_nfs $H0:/$V0 $N0 nolock; TEST ls $N0/.snaps; @@ -152,6 +154,103 @@ TEST fd_close $fd1; TEST fd_close $fd2; TEST fd_close $fd3; +# test 73 +TEST $CLI volume set $V0 "features.snapshot-directory" .history + +TEST ls $M0/.history; + +NUM_SNAPS=$(ls $M0/.history | wc -l); + +TEST [ $NUM_SNAPS == 4 ] + +TEST ls $M0/.history/snap1; +TEST ls $M0/.history/snap2; +TEST ls $M0/.history/snap3; +TEST ls $M0/.history/snap4; + +TEST ls $M0/.history/snap3/dir1; +TEST ls $M0/.history/snap3/dir2; + +TEST ls $M0/.history/snap4/dir1; +TEST ls $M0/.history/snap4/dir2; + +TEST ls $M0/dir1/.history/ +TEST ! ls $M0/dir1/.history/snap1; +TEST ! ls $M0/dir2/.history/snap2; +TEST ls $M0/dir1/.history/snap3; +TEST ls $M0/dir2/.history/snap4; + +TEST fd1=`fd_available` +TEST fd_open $fd1 'r' $M0/.history/snap1/file1; +TEST fd_cat $fd1 + +# opening fd with in write mode for snapshot files should fail +TEST fd2=`fd_available` +TEST ! fd_open $fd1 'w' $M0/.history/snap1/file2; + +# lookup on .history in the snapshot world should fail +TEST ! stat $M0/.history/snap1/.history + +# creating new entries in snapshots should fail +TEST ! mkdir $M0/.history/new +TEST ! touch $M0/.history/snap2/other; + +TEST fd3=`fd_available` +TEST fd_open $fd3 'r' $M0/dir1/.history/snap3/foo1 + +TEST fd_cat $fd3; + +TEST fd_close $fd1; +TEST fd_close $fd2; +TEST fd_close $fd3 + + +# similar tests on nfs mount +# test 103 +TEST ls $N0/.history; + +NUM_SNAPS=$(ls $N0/.history | wc -l); + +TEST [ $NUM_SNAPS == 4 ]; + +TEST ls $N0/.history/snap1; +TEST ls $N0/.history/snap2; +TEST ls $N0/.history/snap3; +TEST ls $N0/.history/snap4; + +TEST ls $N0/.history/snap3/dir1; +TEST ls $N0/.history/snap3/dir2; + +TEST ls $N0/.history/snap4/dir1; +TEST ls $N0/.history/snap4/dir2; + +TEST ! ls $N0/dir1/.history/snap1; +TEST ! ls $N0/dir2/.history/snap2; +TEST ls $N0/dir1/.history/snap3; +TEST ls $N0/dir2/.history/snap4; + +TEST fd1=`fd_available` +TEST fd_open $fd1 'r' $N0/.history/snap1/file1; +TEST fd_cat $fd1 + +TEST fd2=`fd_available` +TEST ! fd_open $fd1 'w' $N0/.history/snap1/file2; + +TEST ! stat $N0/.history/snap1/.stat + +TEST ! mkdir $N0/.history/new + +TEST ! touch $N0/.history/snap2/other; + +TEST fd3=`fd_available` +TEST fd_open $fd3 'r' $N0/dir1/.history/snap3/foo1 + +TEST fd_cat $fd3; + +TEST fd_close $fd1; +TEST fd_close $fd2; +TEST fd_close $fd3; + rm -f /tmp/tmp-snap-uuids; rm -f /tmp/tmp-snap_names; diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index f94c5bca40c..4421e4ddbf7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1097,13 +1097,21 @@ struct volopt_map_entry glusterd_volopt_map[] = { { .key = "features.uss", .voltype = "features/snapview-server", - .op_version = 4, - .value = "uss", + .op_version = GD_OP_VERSION_3_6_0, + .value = "off", .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT, .description = "Enable/Disable User Servicable Snapshots on the " "volume." }, + { .key = "features.snapshot-directory", + .voltype = "features/snapview-client", + .op_version = GD_OP_VERSION_3_6_0, + .value = ".snaps", + .flags = OPT_FLAG_CLIENT_OPT | OPT_FLAG_XLATOR_OPT, + .description = "Entry point directory for entering snapshot world" + }, + #ifdef HAVE_LIB_Z /* Compressor-decompressor xlator options * defaults used from xlator/features/compress/src/cdc.h |