]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/fs/misc/layout_vxattr.sh: detect data pool name
authorSage Weil <sage@redhat.com>
Mon, 4 Jan 2016 14:46:47 +0000 (09:46 -0500)
committerSage Weil <sage@redhat.com>
Tue, 1 Mar 2016 16:16:58 +0000 (11:16 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/fs/misc/layout_vxattrs.sh

index 7284ab6778353c43f084ca7fbc1b4e3ab2b8d50a..2dbb19c962f22f77d28a7d67ff842bcdf2d483b2 100755 (executable)
@@ -2,6 +2,15 @@
 
 set -e
 
+# detect data pool
+datapool=
+dir=.
+while true ; do
+    echo $dir
+    datapool=$(getfattr -n ceph.dir.layout.pool $dir --only-values) && break
+    dir=$dir/..
+done
+
 # file
 rm -f file file2
 touch file file2
@@ -23,33 +32,30 @@ 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
 
-# Assumption: that the data pool is called 'data' and has ID '2'
-# (see teuthology.task.ceph.cephfs_setup)
-setfattr -n ceph.file.layout.pool -v data file2
-setfattr -n ceph.file.layout.pool -v 2 file2
-getfattr -n ceph.file.layout.pool file2 | grep -q data
+setfattr -n ceph.file.layout.pool -v $datapool file2
+getfattr -n ceph.file.layout.pool file2 | grep -q $datapool
 
 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
 
-setfattr -n ceph.file.layout -v "stripe_unit=4194304 stripe_count=16 object_size=41943040 pool=data" file2
+setfattr -n ceph.file.layout -v "stripe_unit=4194304 stripe_count=16 object_size=41943040 pool=$datapool" file2
 getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 4194304
 getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16
 getfattr -n ceph.file.layout.object_size file2 | grep -q 41943040
-getfattr -n ceph.file.layout.pool file2 | grep -q data
+getfattr -n ceph.file.layout.pool file2 | grep -q $datapool
 
 setfattr -n ceph.file.layout -v "stripe_unit=1048576" file2
 getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 1048576
 getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16
 getfattr -n ceph.file.layout.object_size file2 | grep -q 41943040
-getfattr -n ceph.file.layout.pool file2 | grep -q data
+getfattr -n ceph.file.layout.pool file2 | grep -q $datapool
 
-setfattr -n ceph.file.layout -v "stripe_unit=2097152 stripe_count=4 object_size=2097152 pool=data" file2
+setfattr -n ceph.file.layout -v "stripe_unit=2097152 stripe_count=4 object_size=2097152 pool=$datapool" file2
 getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 2097152
 getfattr -n ceph.file.layout.stripe_count file2 | grep -q 4
 getfattr -n ceph.file.layout.object_size file2 | grep -q 2097152
-getfattr -n ceph.file.layout.pool file2 | grep -q data
+getfattr -n ceph.file.layout.pool file2 | grep -q $datapool
 
 # dir
 rm -f dir/file || true
@@ -58,33 +64,31 @@ 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
+getfattr -n ceph.dir.layout dir                      && 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
 
-# Assumption: that the data pool is called 'data' and has ID '2'
-# (see teuthology.task.ceph.cephfs_setup)
-setfattr -n ceph.dir.layout.pool -v data dir
-setfattr -n ceph.dir.layout.pool -v 2 dir
+setfattr -n ceph.dir.layout.pool -v $datapool 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 dir | grep -q pool=$datapool
+getfattr -n ceph.dir.layout.pool dir | grep -q $datapool
 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
 
 setfattr -n ceph.file.layout -v "stripe_count=16" file2
 getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16
-setfattr -n ceph.file.layout -v "object_size=10485760 stripe_count=8 stripe_unit=1048576 pool=data" file2
+setfattr -n ceph.file.layout -v "object_size=10485760 stripe_count=8 stripe_unit=1048576 pool=$datapool" file2
 getfattr -n ceph.file.layout.stripe_count file2 | grep -q 8
 
 touch dir/file
-getfattr -n ceph.file.layout.pool dir/file | grep -q data
+getfattr -n ceph.file.layout.pool dir/file | grep -q $datapool
 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