2011-06-24 01:06:01 +00:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
|
|
|
MB=1048576
|
|
|
|
twoMB=$((2*MB))
|
|
|
|
|
2011-06-28 17:35:05 +00:00
|
|
|
rm -r layout_test || true
|
|
|
|
rm new_layout || true
|
|
|
|
rm file2_layout || true
|
|
|
|
rm temp || true
|
|
|
|
|
|
|
|
echo "layout.data_pool: 0
|
|
|
|
layout.object_size: 1048576
|
|
|
|
layout.stripe_unit: 1048576
|
|
|
|
layout.stripe_count: 1
|
|
|
|
layout.preferred_osd: -1" > new_layout
|
|
|
|
echo "layout.data_pool: 0
|
|
|
|
layout.object_size: 2097152
|
|
|
|
layout.stripe_unit: 1048576
|
|
|
|
layout.stripe_count: 2
|
|
|
|
layout.preferred_osd: -1" > file2_layout
|
2011-08-18 18:23:42 +00:00
|
|
|
echo "layout.data_pool: 3
|
2011-08-25 19:40:55 +00:00
|
|
|
layout.object_size: 1048576
|
2011-08-18 18:23:42 +00:00
|
|
|
layout.stripe_unit: 1048576
|
2011-08-25 19:40:55 +00:00
|
|
|
layout.stripe_count: 1
|
2011-08-18 18:23:42 +00:00
|
|
|
layout.preferred_osd: -1" > file3_layout
|
2011-08-25 19:40:55 +00:00
|
|
|
echo "layout.data_pool: 0
|
|
|
|
layout.object_size: 1048576
|
|
|
|
layout.stripe_unit: 262144
|
|
|
|
layout.stripe_count: 1
|
|
|
|
layout.preferred_osd: -1" > file4_layout
|
|
|
|
|
2011-06-28 17:35:05 +00:00
|
|
|
|
2011-06-24 01:06:01 +00:00
|
|
|
mkdir layout_test
|
2011-06-29 16:51:36 +00:00
|
|
|
cephfs layout_test show_layout
|
|
|
|
cephfs layout_test set_layout -u $MB -c 1 -s $MB
|
2011-06-24 01:06:01 +00:00
|
|
|
touch layout_test/file1
|
2011-06-29 16:51:36 +00:00
|
|
|
cephfs layout_test/file1 show_layout > temp
|
2011-06-28 17:35:05 +00:00
|
|
|
diff new_layout temp || return 1
|
2011-08-18 18:23:42 +00:00
|
|
|
echo "hello, I'm a file" > layout_test/file1
|
2011-06-29 16:51:36 +00:00
|
|
|
cephfs layout_test/file1 show_layout > temp
|
2011-06-28 17:35:05 +00:00
|
|
|
diff new_layout temp || return 1
|
2011-06-24 01:06:01 +00:00
|
|
|
touch layout_test/file2
|
2011-06-29 16:51:36 +00:00
|
|
|
cephfs layout_test/file2 show_layout > temp
|
2011-06-28 17:35:05 +00:00
|
|
|
diff new_layout temp || return 1
|
2011-06-29 16:51:36 +00:00
|
|
|
cephfs layout_test/file2 set_layout -u $MB -c 2 -s $twoMB
|
|
|
|
cephfs layout_test/file2 show_layout > temp
|
2011-06-28 17:35:05 +00:00
|
|
|
diff file2_layout temp || return 1
|
|
|
|
|
|
|
|
echo "hello, I'm a file with a custom layout" > layout_test/file2
|
2011-08-18 18:23:42 +00:00
|
|
|
|
|
|
|
touch layout_test/file3
|
|
|
|
cephfs layout_test/file3 show_layout > temp
|
|
|
|
diff new_layout temp || return 1
|
2012-03-12 21:58:19 +00:00
|
|
|
sudo ls /sys/kernel/debug/ceph
|
2012-03-12 03:36:47 +00:00
|
|
|
sudo cat /sys/kernel/debug/ceph/\*/mdsmap > temp
|
2011-08-18 18:23:42 +00:00
|
|
|
ceph osd pool create newpool || true
|
|
|
|
ceph mds add_data_pool 3 || true
|
2012-03-12 03:36:47 +00:00
|
|
|
sudo cat /sys/kernel/debug/ceph/\*/mdsmap > temp2
|
2011-09-08 20:27:19 +00:00
|
|
|
while diff -q temp2 temp
|
|
|
|
do
|
|
|
|
echo "waiting for mdsmap to update"
|
|
|
|
sleep 1
|
2012-03-12 03:36:47 +00:00
|
|
|
sudo cat /sys/kernel/debug/ceph/\*/mdsmap > temp2
|
2011-09-08 20:27:19 +00:00
|
|
|
done
|
2011-09-09 21:47:42 +00:00
|
|
|
sudo rm temp temp2
|
2011-09-08 20:27:19 +00:00
|
|
|
|
2011-08-25 19:40:55 +00:00
|
|
|
cephfs layout_test/file3 set_layout -p 3
|
2011-08-18 18:23:42 +00:00
|
|
|
cephfs layout_test/file3 show_layout > temp
|
|
|
|
diff file3_layout temp || return 1
|
|
|
|
echo "hello, I'm a file in pool3" > layout_test/file3
|
|
|
|
|
2011-08-25 19:40:55 +00:00
|
|
|
touch layout_test/file4
|
|
|
|
cephfs layout_test/file4 show_layout > temp
|
|
|
|
diff new_layout temp || return 1
|
|
|
|
cephfs layout_test/file4 set_layout -u 262144
|
|
|
|
cephfs layout_test/file4 show_layout > temp
|
|
|
|
diff file4_layout temp || return 1
|
|
|
|
echo "hello, I'm a file with a small stripe unit!" > layout_test/file3
|
|
|
|
|
2011-06-28 17:35:05 +00:00
|
|
|
sync
|
2011-06-29 16:51:36 +00:00
|
|
|
echo "OK"
|