summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-01-19 11:33:04 -0800
committerSage Weil <sage@inktank.com>2013-02-04 22:05:28 -0800
commit62ed62f5e2fb068cee38612d7974526aa1b3c759 (patch)
tree396902927d6fcadfe15d0d6e13395e8e3915065a
parentd386622c3961a3b57eea42fdb82611cd2e904f4d (diff)
downloadceph-62ed62f5e2fb068cee38612d7974526aa1b3c759.tar.gz
qa: add layout_vxattrs.sh test script
Test virtual xattrs for file and directory layouts. TODO: create a data pool, add it to the fs, and make sure we can use it. Signed-off-by: Sage Weil <sage@inktank.com> (cherry picked from commit 61fbe27a52d12ecd98ddeb5fc0965c4f8ee7841a)
-rwxr-xr-xqa/workunits/misc/layout_vxattrs.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/qa/workunits/misc/layout_vxattrs.sh b/qa/workunits/misc/layout_vxattrs.sh
new file mode 100755
index 00000000000..d181e03212c
--- /dev/null
+++ b/qa/workunits/misc/layout_vxattrs.sh
@@ -0,0 +1,68 @@
+#!/bin/bash -x
+
+set -e
+
+# file
+rm -f file file2
+touch file file2
+
+getfattr -d -m - file | grep -q ceph.file.layout
+getfattr -d -m - file | grep -q ceph.file.layout.pool && exit 1 || true
+
+getfattr -n ceph.file.layout file
+getfattr -n ceph.file.layout file | grep -q object_size=
+getfattr -n ceph.file.layout file | grep -q stripe_count=
+getfattr -n ceph.file.layout file | grep -q stripe_unit=
+getfattr -n ceph.file.layout file | grep -q pool=
+getfattr -n ceph.file.layout.pool file
+getfattr -n ceph.file.layout.stripe_unit file
+getfattr -n ceph.file.layout.stripe_count file
+getfattr -n ceph.file.layout.object_size file
+
+getfattr -n ceph.file.layout.bogus file 2>&1 | grep -q 'No such attribute'
+getfattr -n ceph.dir.layout file 2>&1 | grep -q 'No such attribute'
+
+setfattr -n ceph.file.layout.stripe_unit -v 1048576 file2
+setfattr -n ceph.file.layout.stripe_count -v 8 file2
+setfattr -n ceph.file.layout.object_size -v 10485760 file2
+setfattr -n ceph.file.layout.pool -v data file2
+setfattr -n ceph.file.layout.pool -v 0 file2
+getfattr -n ceph.file.layout.pool file2 | grep -q data
+getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 1048576
+getfattr -n ceph.file.layout.stripe_count file2 | grep -q 8
+getfattr -n ceph.file.layout.object_size file2 | grep -q 10485760
+
+# dir
+rm -f dir/file || true
+rmdir dir || true
+mkdir -p dir
+
+getfattr -d -m - dir | grep -q ceph.dir.layout && exit 1 || true
+getfattr -d -m - dir | grep -q ceph.file.layout && exit 1 || true
+
+setfattr -n ceph.dir.layout.stripe_unit -v 1048576 dir
+setfattr -n ceph.dir.layout.stripe_count -v 8 dir
+setfattr -n ceph.dir.layout.object_size -v 10485760 dir
+setfattr -n ceph.dir.layout.pool -v data dir
+setfattr -n ceph.dir.layout.pool -v 0 dir
+getfattr -n ceph.dir.layout dir
+getfattr -n ceph.dir.layout dir | grep -q object_size=10485760
+getfattr -n ceph.dir.layout dir | grep -q stripe_count=8
+getfattr -n ceph.dir.layout dir | grep -q stripe_unit=1048576
+getfattr -n ceph.dir.layout dir | grep -q pool=data
+getfattr -n ceph.dir.layout.pool dir | grep -q data
+getfattr -n ceph.dir.layout.stripe_unit dir | grep -q 1048576
+getfattr -n ceph.dir.layout.stripe_count dir | grep -q 8
+getfattr -n ceph.dir.layout.object_size dir | grep -q 10485760
+
+touch dir/file
+getfattr -n ceph.file.layout.pool dir/file | grep -q data
+getfattr -n ceph.file.layout.stripe_unit dir/file | grep -q 1048576
+getfattr -n ceph.file.layout.stripe_count dir/file | grep -q 8
+getfattr -n ceph.file.layout.object_size dir/file | grep -q 10485760
+
+setfattr -x ceph.dir.layout dir
+getfattr -n ceph.dir.layout dir 2>&1 | grep -q 'No such attribute'
+
+echo OK
+