From 4f0939bcc0ce3ea536ae705684769c714aa04a72 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 20 Jul 2017 17:08:12 +0530 Subject: tools/setgfid2path: Tool to set GFID to Path xattr in brick backend Once storage/gfid2path feature is enabled using `gluster volume set storage.gfid2path enable`, it starts recording the gfid2path xattr on each files. But this feature will not add xattr to the existing files. This tool accepts the file path as argument and sets the necessary xattr required for this feature. > Reviewed-on: https://review.gluster.org/17839 > Smoke: Gluster Build System > Reviewed-by: Niels de Vos > Reviewed-by: Kotresh HR > Tested-by: Kotresh HR > CentOS-regression: Gluster Build System > (cherry picked from commit 1ae254ddcf397b101d291342272e13af25b0b1a1) Change-Id: I75ad82c86ce482950645e687ff2e33b413fa53da Updates: #139 Signed-off-by: Aravinda VK Reviewed-on: https://review.gluster.org/17914 CentOS-regression: Gluster Build System Reviewed-by: Kotresh HR Smoke: Gluster Build System --- tests/gfid2path/gfid2path_fuse.t | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tests/gfid2path') diff --git a/tests/gfid2path/gfid2path_fuse.t b/tests/gfid2path/gfid2path_fuse.t index 38798cf60d0..a66ab183683 100644 --- a/tests/gfid2path/gfid2path_fuse.t +++ b/tests/gfid2path/gfid2path_fuse.t @@ -3,6 +3,8 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +CLI_SETGFID2PATH="gluster-setgfid2path"; + cleanup; XXHSUM_SOURCE="$(dirname $0)/../../contrib/xxhash/xxhsum.c $(dirname $0)/../../contrib/xxhash/xxhash.c" @@ -25,15 +27,30 @@ EXPECT '1' brick_count $V0 TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; -## enable gfid2path -TEST $CLI volume set $V0 gfid2path enable - ## Mount the volume TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0; pgfid="00000000-0000-0000-0000-000000000001" xxh64_file=$B0/${V0}1/xxh64_file +# Create a file before enabling gfid2path +fname=$M0/before_file1 +touch $fname; +backpath=$B0/${V0}1/before_file1 + +# Set gfid2path xattr +TEST $CLI_SETGFID2PATH $backpath + +#Check for the presence of xattr +pgfid_bname=$pgfid/before_file1 +echo -n $pgfid_bname > $xxh64_file +xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +key="trusted.gfid2path.$xxh64sum" +EXPECT $pgfid_bname get_text_xattr $key $backpath + +## enable gfid2path +TEST $CLI volume set $V0 gfid2path enable + #CREATE fname=$M0/file1 touch $fname; -- cgit