summaryrefslogtreecommitdiffstats
path: root/tests/gfid2path
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2017-07-20 17:08:12 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-07-28 14:53:20 +0000
commit1ae254ddcf397b101d291342272e13af25b0b1a1 (patch)
treea979684704b882f5717ce4e2f6a5c3c3c913ba70 /tests/gfid2path
parentb5fa5ae05f73e03023db37e43fb203267b719160 (diff)
tools/setgfid2path: Tool to set GFID to Path xattr in brick backend
Once storage/gfid2path feature is enabled using `gluster volume set <volname> 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. Change-Id: I75ad82c86ce482950645e687ff2e33b413fa53da Updates: #139 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: https://review.gluster.org/17839 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Tested-by: Kotresh HR <khiremat@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'tests/gfid2path')
-rw-r--r--tests/gfid2path/gfid2path_fuse.t23
1 files changed, 20 insertions, 3 deletions
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;