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 for i in `ls /proc/fs/lustre/lov/*/qos_threshold`; do
21 echo $(($1/1024)) > $i
23 for i in `ls /proc/fs/lustre/lov/*/qos_maxage`; do
28 # assume all osts has same free space
29 OSTCOUNT=`cat /proc/fs/lustre/lov/*/activeobd | head -n 1`
30 TOTALAVAIL=`cat /proc/fs/lustre/llite/*/kbytesavail | head -n 1`
31 SINGLEAVAIL=$(($TOTALAVAIL/$OSTCOUNT))
32 MINFREE=$((1024 * 4)) # 4M
33 TOTALFFREE=`cat /proc/fs/lustre/llite/*/filesfree | head -n 1`
35 if [ $SINGLEAVAIL -lt $MINFREE ]; then
36 echo "ERROR: single ost free size($SINGLEAVAIL kb) is too low!"
39 if [ $OSTCOUNT -lt 3 ]; then
40 echo "WARN: ost count($OSTCOUNT) must be greater than 2!"
45 echo "[qos test 1]: creation skip almost full OST (avail space < threshold)"
47 # set qos_threshold as half ost size
48 THRESHOLD=$(($SINGLEAVAIL/2))
49 set_qos $THRESHOLD $MAXAGE
51 # set stripe number to 1
52 $LFS setstripe $QOSFILE 65536 -1 1
53 FULLOST=`$LFS getstripe -q $QOSFILE | awk '/\s*\d*/ {print $1}'`
55 # floodfill the FULLOST
56 echo "$TAB fill the OST $FULLOST to almost fullness..."
57 dd if=/dev/zero of=$QOSFILE count=$(($SINGLEAVAIL - $THRESHOLD + 1500)) bs=1k > /dev/null 2>&1 || return 1
60 sleep $(($MAXAGE * 2))
61 echo "$TAB create 10 files with 1 stripe"
64 $LFS setstripe $MOUNT/file-$i 65536 -1 1
65 idx=`$LFS getstripe -q $MOUNT/file-$i | awk '/\s*\d*/ {print $1}'`
66 if [ $idx -eq $FULLOST ]; then
67 echo "$TAB ERROR: create object on full OST $FULLOST"
71 echo "$TAB no object created on OST $FULLOST"
78 # set threshold and maxage to normal value
86 echo "[qos test 2]: creation balancing over all OSTs by free space"
88 if [ $OSTCOUNT -lt 3 ]; then
89 echo "$TAB WARN: OST count < 3, test skipped"
93 WADSZ=$(($SINGLEAVAIL * 3 / 4))
94 TOTALSZ=$(($WADSZ * $OSTCOUNT - 1))
96 # fill all OST 0 to 3/4 fulness
97 $LFS setstripe $QOSFILE 65536 0 1
98 echo "$TAB fill the OST 0 to 3/4 fulness..."
99 dd if=/dev/zero of=$QOSFILE count=$WADSZ bs=1k > /dev/null 2>&1 || return 1
102 # write 2 stripe files to fill up other OSTs
104 echo "$TAB create $LOOPCNT files with 2 stripe..."
105 for i in `seq $LOOPCNT`; do
107 $LFS setstripe $MOUNT/file-$i 65536 -1 2
111 # the objects created on OST 0 should be 1/4 of on other OSTs'
112 CNT0=`$LFS getstripe -q /mnt/lustre | awk '/\s*\d*/ {print $1}'| grep -c 0`
114 echo "$TAB object created on OST 0: $CNT0"
116 # the object count of other osts must be greater than 2 times
118 for i in `seq $(($OSTCOUNT - 1))`; do
119 CNT=`$LFS getstripe -q /mnt/lustre | awk '/\s*\d*/ {print $1}'| grep -c $i`
120 echo "$TAB object created on OST $i: $CNT"
121 if [ $CNT0 -gt $CNT ] ; then
122 echo "$TAB ERROR: too much objects created on OST 0"
126 echo "$TAB objects created on OST 0 is about 1/4 of others'"
129 for i in `seq $LOOPCNT`; do
140 [ $? -ne 0 ] && exit 1