]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/test_crush_bucket.sh
837fd0a54b227ed7316ffb92061fe92b3c3769c3
4 #Generic test_crush_bucket test
8 source $
(dirname $0)/detect-build-env-vars.sh
9 source ..
/qa
/standalone
/ceph-helpers.sh
14 export CEPH_MON
="127.0.0.1:17119" # git grep '\<17119\>' : there must be only one
16 CEPH_ARGS
+="--fsid=$(uuidgen) --auth-supported=none "
17 CEPH_ARGS
+="--mon-host=$CEPH_MON "
19 local funcs
=${@:-$(set | ${SED} -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
20 for func
in $funcs ; do
21 $func $dir ||
return 1
25 function TEST_crush_bucket
() {
27 setup
$dir ||
return 1
28 run_mon
$dir a ||
return 1
29 run_osd
$dir 0 ||
return 1
30 run_osd
$dir 1 ||
return 1
31 run_osd
$dir 2 ||
return 1
34 ceph osd getcrushmap
-o "$dir/map1" ||
return 1
35 crushtool
-d "$dir/map1" -o "$dir/map1.txt"||
return 1
36 local var
=`ceph osd crush dump|grep -w id|grep '-'|grep -Eo '[0-9]+'|sort|uniq|${SED} -n '$p'`
37 local id
=`expr $var + 1`
38 local item
=`${SED} -n '/^root/,/}/p' $dir/map1.txt|grep 'item'|head -1`
39 local weight
=`${SED} -n '/^root/,/}/p' $dir/map1.txt|grep 'item'|head -1|awk '{print $4}'`
40 local bucket
="host test {\n id -$id\n # weight $weight\n alg straw \n hash 0 # rjenkins1 \n $item\n}\n"
41 ${SED} -i "/# buckets/a\ $bucket" "$dir/map1.txt"
42 crushtool
-c "$dir/map1.txt" -o "$dir/map1.bin" 2>"$dir/rev"
43 local result
=$
(cat "$dir/rev")
44 if [ "$result" != "" ];