# enable freeblock policy on MDS and client
qos_setval QoS_freeblock_imbalance 0 || error
qos_setval QoS_freeblock_imbalance 0 ${CLIENT} || error
- # cleanup test mount. This is needed to get system balanced
- rm -r $MOUNT/* >& /dev/null
- # create test directory
- mkdir $DIR/d3 || error
# initialize QoS on MDS and client
df $MOUNT > /dev/null
${RSH} ${CLIENT} df $MOUNT > /dev/null
# create imbalance on local mount
for ((i=0; $i<$ALOT; i=$i+1)); do
- ${LSTRIPE} $DIR/d3/imbalance$i 0 $1 1 || error
- echo "hello, world" > $DIR/d3/imbalance$i
+ ${LSTRIPE} $1/imbalance$i 0 $2 1 || error
+ echo "hello, world" > $1/imbalance$i
done
}
-imbalance_check_and_clean() {
+imbalance_check() {
# create a lot of files on the remote node
for ((i=0; $i<$ALOT; i=$i+1)); do
- ${RSH} ${CLIENT} "cd ${FULL_SRCDIR}; PATH=$FULL_SRCDIR/../utils:\$PATH ${LSTRIPE} $DIR/d3/test$i 0 -1 1" || error
+ ${RSH} ${CLIENT} "cd ${FULL_SRCDIR}; PATH=$FULL_SRCDIR/../utils:\$PATH ${LSTRIPE} $1/test$i 0 -1 1" || error
done
for ((i=0; $i<$ALOT; i=$i+1)); do
# get the OST number for each new file
- obd=`${LFIND} $DIR/d3/test$i | tail -2 | head -1 | awk '{ print $1 }'`
- # the file must not be on OST $1, since we are still imbalanced
- if [ $obd -eq $1 ]; then
- echo "$DIR/d3/test$i OST $obd"
+ obd=`${LFIND} $1/test$i | tail -2 | head -1 | awk '{ print $1 }'`
+ # the file must not be on OST $2, since we are still imbalanced
+ if [ $obd -eq $2 ]; then
+ echo "$1/test$i OST $obd"
error
fi
done
- rm -rf $DIR/d3
}
-# check whether create updates QOS information on remove node
-test_3() {
- imbalance_setup 0
+# check whether create updates QOS information
+test_3a() {
+ # create test directory
+ mkdir $DIR/d3a || error
+ imbalance_setup $DIR/d3a 0
# create a file on the MDS and the remote node (this is the QOS update trigger)
- ${LSTRIPE} $DIR/d3/trigger1 0 0 1 || error
- ${RSH} ${CLIENT} "cd ${FULL_SRCDIR}; PATH=$FULL_SRCDIR/../utils:\$PATH ${LSTRIPE} $DIR/d3/trigger2 0 0 1" || error
- # sleep a while to make QOS propagate
- usleep 500
- imbalance_check_and_clean 0
+ ${LSTRIPE} $DIR/d3a/trigger1 0 0 1 || error
+ ${RSH} ${CLIENT} "cd ${FULL_SRCDIR}; PATH=$FULL_SRCDIR/../utils:\$PATH ${LSTRIPE} $DIR/d3a/trigger2 0 0 1" || error
+ imbalance_check $DIR/d3a 0
+ rm -rf $DIR/d3a
+}
+run_test 3a "check QOS propagation on create"
+
+# check whether delete updates QOS information
+test_3b() {
+ # create test directory
+ mkdir $DIR/d3b || error
+ # create two files for later removal
+ ${LSTRIPE} $DIR/d3b/trigger1 0 0 1 || error
+ ${LSTRIPE} $DIR/d3b/trigger2 0 0 1 || error
+ imbalance_setup $DIR/d3b 0
+ # remove the trigger files (this is the QOS update trigger) on both nodes
+ rm -f $DIR/d3b/trigger1 || error
+ ${RSH} ${CLIENT} "rm -f $DIR/d3b/trigger2" || error
+ imbalance_check $DIR/d3b 0
+ rm -rf $DIR/d3b
+}
+run_test 3b "check QOS propagation on delete"
+
+# check whether getattr updates QOS information
+test_3c() {
+ # create test directory
+ mkdir $DIR/d3c || error
+ # create two files for later stat
+ ${LSTRIPE} $DIR/d3c/trigger1 0 0 1 || error
+ ${LSTRIPE} $DIR/d3c/trigger2 0 0 1 || error
+ imbalance_setup $DIR/d3c 0
+ # stat the trigger files (this is the QOS update trigger) on both nodes
+ stat $DIR/d3c/trigger1 > /dev/null || error
+ ${RSH} ${CLIENT} "stat $DIR/d3c/trigger2 > /dev/null" || error
+ imbalance_check $DIR/d3c 0
+ rm -rf $DIR/d3c
+}
+run_test 3c "check QOS propagation on getattr"
+
+# check whether setattr updates QOS information
+test_3d() {
+ # create test directory
+ mkdir $DIR/d3d || error
+ # create two files for later chmod
+ ${LSTRIPE} $DIR/d3d/trigger1 0 0 1 || error
+ ${LSTRIPE} $DIR/d3d/trigger2 0 0 1 || error
+ imbalance_setup $DIR/d3d 0
+ # chmod the trigger files (this is the QOS update trigger) on both nodes
+ chmod 777 $DIR/d3d/trigger1 || error
+ ${RSH} ${CLIENT} "chmod 777 $DIR/d3d/trigger2" || error
+ imbalance_check $DIR/d3d 0
+ rm -rf $DIR/d3d
+}
+run_test 3d "check QOS propagation on setattr"
+
+# check whether open/close updates QOS information
+test_3e() {
+ # create test directory
+ mkdir $DIR/d3e || error
+ # create two files for later cat (open/close)
+ ${LSTRIPE} $DIR/d3e/trigger1 0 0 1 || error
+ ${LSTRIPE} $DIR/d3e/trigger2 0 0 1 || error
+ imbalance_setup $DIR/d3e 0
+ # cat (open/close) the trigger files (this is the QOS update trigger) on both nodes
+ cat $DIR/d3e/trigger1 || error
+ ${RSH} ${CLIENT} "cat $DIR/d3e/trigger2" || error
+ imbalance_check $DIR/d3e 0
+ rm -rf $DIR/d3e
+}
+run_test 3e "check QOS propagation on open/close"
+
+# check whether punch updates QOS information
+test_3f() {
+ # create test directory
+ mkdir $DIR/d3f || error
+ # create two files for later truncate
+ ${LSTRIPE} $DIR/d3f/trigger1 0 0 1 || error
+ ${LSTRIPE} $DIR/d3f/trigger2 0 0 1 || error
+ imbalance_setup $DIR/d3f 0
+ # truncate the trigger files (this is the QOS update trigger) on both nodes
+ ./truncate $DIR/d3f/trigger1 1 || error
+ ${RSH} ${CLIENT} "cd ${FULL_SRCDIR}; ./truncate $DIR/d3f/trigger2 1" || error
+ imbalance_check $DIR/d3f 0
+ rm -rf $DIR/d3f
}
-run_test 3 "check QOS propagation on create"
+run_test 3f "check QOS propagation on punch"
TMPDIR=$OLDTMPDIR
TMP=$OLDTMP