5 export PATH=`dirname $0`/../utils:$PATH
9 MOUNT=${MOUNT:-/mnt/lustre}
12 QOSFILE=$MOUNT/qos_file
15 echo "remove all files on $MOUNT..."
17 sleep 1 # to ensure we get up-to-date statfs info
20 lctl set_param lov.*.qos_threshold=$(($1/1024))
21 lctl set_param lov.*.qos_maxage=$2
24 # assume all osts has same free space
25 OSTCOUNT=$(lctl get_param -n lov.*.activeobd | head -n 1)
26 TOTALAVAIL=$(lctl get_param -n llite.*.kbytesavail | head -n 1)
27 SINGLEAVAIL=$(($TOTALAVAIL/$OSTCOUNT))
28 MINFREE=$((1024 * 4)) # 4M
29 TOTALFFREE=$(lctl get_param -n llite.*.filesfree | head -n 1)
31 if [ $SINGLEAVAIL -lt $MINFREE ]; then
32 echo "ERROR: single ost free size($SINGLEAVAIL kb) is too low!"
35 if [ $OSTCOUNT -lt 3 ]; then
36 echo "WARN: ost count($OSTCOUNT) must be greater than 2!"
41 echo "[qos test 1]: creation skip almost full OST (avail space < threshold)"
43 # set qos_threshold as half ost size
44 THRESHOLD=$(($SINGLEAVAIL/2))
45 set_qos $THRESHOLD $MAXAGE
47 # set stripe number to 1
48 $LFS setstripe $QOSFILE 65536 -1 1
49 FULLOST=`$LFS getstripe -q $QOSFILE | awk '/\s*\d*/ {print $1}'`
51 # floodfill the FULLOST
52 echo "$TAB fill the OST $FULLOST to almost fullness..."
53 dd if=/dev/zero of=$QOSFILE count=$(($SINGLEAVAIL - $THRESHOLD + 1500)) bs=1k > /dev/null 2>&1 || return 1
56 sleep $(($MAXAGE * 2))
57 echo "$TAB create 10 files with 1 stripe"
60 $LFS setstripe $MOUNT/file-$i 65536 -1 1
61 idx=`$LFS getstripe -q $MOUNT/file-$i | awk '/\s*\d*/ {print $1}'`
62 if [ $idx -eq $FULLOST ]; then
63 echo "$TAB ERROR: create object on full OST $FULLOST"
67 echo "$TAB no object created on OST $FULLOST"
74 # set threshold and maxage to normal value
82 echo "[qos test 2]: creation balancing over all OSTs by free space"
84 if [ $OSTCOUNT -lt 3 ]; then
85 echo "$TAB WARN: OST count < 3, test skipped"
89 WADSZ=$(($SINGLEAVAIL * 3 / 4))
90 TOTALSZ=$(($WADSZ * $OSTCOUNT - 1))
92 # fill all OST 0 to 3/4 fulness
93 $LFS setstripe $QOSFILE 65536 0 1
94 echo "$TAB fill the OST 0 to 3/4 fulness..."
95 dd if=/dev/zero of=$QOSFILE count=$WADSZ bs=1k > /dev/null 2>&1 || return 1
98 # write 2 stripe files to fill up other OSTs
100 echo "$TAB create $LOOPCNT files with 2 stripe..."
101 for i in `seq $LOOPCNT`; do
103 $LFS setstripe $MOUNT/file-$i 65536 -1 2
107 # the objects created on OST 0 should be 1/4 of on other OSTs'
108 CNT0=`$LFS getstripe -q /mnt/lustre | awk '/\s*\d*/ {print $1}'| grep -c 0`
110 echo "$TAB object created on OST 0: $CNT0"
112 # the object count of other osts must be greater than 2 times
114 for i in `seq $(($OSTCOUNT - 1))`; do
115 CNT=`$LFS getstripe -q /mnt/lustre | awk '/\s*\d*/ {print $1}'| grep -c $i`
116 echo "$TAB object created on OST $i: $CNT"
117 if [ $CNT0 -gt $CNT ] ; then
118 echo "$TAB ERROR: too much objects created on OST 0"
122 echo "$TAB objects created on OST 0 is about 1/4 of others'"
125 for i in `seq $LOOPCNT`; do
136 [ $? -ne 0 ] && exit 1