Whamcloud - gitweb
LU-3326 tests: limit the disk space used by run_*.sh 76/6376/5
authorHongchao Zhang <hongchao.zhang@intel.com>
Tue, 13 Aug 2013 13:40:21 +0000 (21:40 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 15 Aug 2013 17:28:37 +0000 (17:28 +0000)
In run_dd.sh and run_tar.sh, limit the disk space to be used
according to the total free disk space and the client counts.

Test-Parameters: envdefinitions=ENABLE_QUOTA=yes \
clientdistro=el6 serverdistro=el6 clientarch=x86_64 \
serverarch=x86_64 \
clientcount=4 osscount=2 mdscount=2 \
austeroptions=-R failover=true useiscsi=true \
testlist=recovery-mds-scale

Change-Id: I61ea1167906312fdb182b67d7169e95cad1b6d72
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Signed-off-by: Jian Yu <jian.yu@intel.com>
Reviewed-on: http://review.whamcloud.com/6376
Tested-by: Hudson
Reviewed-by: Minh Diep <minh.diep@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/run_dd.sh
lustre/tests/run_tar.sh
lustre/tests/test-framework.sh

index da11efa..8e1cfdd 100755 (executable)
@@ -17,7 +17,7 @@ set -x
 
 . $(dirname $0)/functions.sh
 
 
 . $(dirname $0)/functions.sh
 
-assert_env MOUNT END_RUN_FILE LOAD_PID_FILE LFS
+assert_env MOUNT END_RUN_FILE LOAD_PID_FILE LFS CLIENT_COUNT
 
 trap signaled TERM
 
 
 trap signaled TERM
 
@@ -35,8 +35,8 @@ while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
        # suppress dd xfer stat to workaround buggy coreutils/gettext
        # combination in RHEL5 and OEL5, see BZ 21264
        FREE_SPACE=$($LFS df $TESTDIR|awk '/filesystem summary:/ {print $5}')
        # suppress dd xfer stat to workaround buggy coreutils/gettext
        # combination in RHEL5 and OEL5, see BZ 21264
        FREE_SPACE=$($LFS df $TESTDIR|awk '/filesystem summary:/ {print $5}')
-       BLKS=$((FREE_SPACE * 9 / 40))
-       echoerr "Free disk space is $FREE_SPACE, 4k blocks to dd is $BLKS"
+       BLKS=$((FREE_SPACE * 9 / 40 / CLIENT_COUNT))
+       echoerr "Total free disk space is $FREE_SPACE, 4k blocks to dd is $BLKS"
 
        dd bs=4k count=$BLKS status=noxfer if=/dev/zero of=$TESTDIR/dd-file \
                                                                1>$LOG &
 
        dd bs=4k count=$BLKS status=noxfer if=/dev/zero of=$TESTDIR/dd-file \
                                                                1>$LOG &
index f46b874..823c781 100755 (executable)
@@ -17,7 +17,7 @@ set -x
 
 . $(dirname $0)/functions.sh
 
 
 . $(dirname $0)/functions.sh
 
-assert_env MOUNT END_RUN_FILE LOAD_PID_FILE
+assert_env MOUNT END_RUN_FILE LOAD_PID_FILE LFS CLIENT_COUNT
 
 trap signaled TERM
 
 
 trap signaled TERM
 
@@ -33,32 +33,41 @@ do_tar() {
 
 CONTINUE=true
 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
 
 CONTINUE=true
 while [ ! -e "$END_RUN_FILE" ] && $CONTINUE; do
-    echoerr "$(date +'%F %H:%M:%S'): tar run starting"
-    mkdir -p $TESTDIR
-    cd $TESTDIR
-    do_tar &
-    wait $!
-    RC=$?
-    PREV_ERRORS=$(grep "exit delayed from previous errors" $LOG) || true
-    if [ $RC -ne 0 -a "$ERRORS_OK" -a "$PREV_ERRORS" ]; then
-        echoerr "$(date +'%F %H:%M:%S'): tar errors earlier, ignoring"
-        RC=0
-    fi
-    if [ $RC -eq 0 ]; then
-        echoerr "$(date +'%F %H:%M:%S'): tar succeeded"
-        cd $TMP
-        rm -rf $TESTDIR
-        echoerr "$(date +'%F %H:%M:%S'): tar run finished"
-    else
-        echoerr "$(date +'%F %H:%M:%S'): tar failed"
-        if [ -z "$ERRORS_OK" ]; then
-            echo $(hostname) >> $END_RUN_FILE
-        fi
-        if [ $BREAK_ON_ERROR ]; then
-            # break
-            CONTINUE=false
-        fi
-    fi
+       echoerr "$(date +'%F %H:%M:%S'): tar run starting"
+       mkdir -p $TESTDIR
+       USAGE=$(du -s /etc | awk '{print $1}')
+       FREE_SPACE=$($LFS df $TESTDIR | awk '/filesystem summary:/ {print $5}')
+       AVAIL=$((FREE_SPACE * 9 / 10 / CLIENT_COUNT))
+       if [ $AVAIL -lt $USAGE ]; then
+               echoerr "no enough free disk space: need $USAGE, avail $AVAIL"
+               echo $(hostname) >> $END_RUN_FILE
+               break
+       fi
+
+       cd $TESTDIR
+       do_tar &
+       wait $!
+       RC=$?
+       PREV_ERRORS=$(grep "exit delayed from previous errors" $LOG) || true
+       if [ $RC -ne 0 -a "$ERRORS_OK" -a "$PREV_ERRORS" ]; then
+               echoerr "$(date +'%F %H:%M:%S'): tar errors earlier, ignoring"
+               RC=0
+       fi
+       if [ $RC -eq 0 ]; then
+               echoerr "$(date +'%F %H:%M:%S'): tar succeeded"
+               cd $TMP
+               rm -rf $TESTDIR
+               echoerr "$(date +'%F %H:%M:%S'): tar run finished"
+       else
+               echoerr "$(date +'%F %H:%M:%S'): tar failed"
+               if [ -z "$ERRORS_OK" ]; then
+                       echo $(hostname) >> $END_RUN_FILE
+               fi
+               if [ $BREAK_ON_ERROR ]; then
+                       # break
+                       CONTINUE=false
+               fi
+       fi
 done
 
 echoerr "$(date +'%F %H:%M:%S'): tar run exiting"
 done
 
 echoerr "$(date +'%F %H:%M:%S'): tar run exiting"
index 963db0b..acaf0e8 100644 (file)
@@ -1664,6 +1664,7 @@ TESTLOG_PREFIX=$TESTLOG_PREFIX \
 TESTNAME=$TESTNAME \
 DBENCH_LIB=$DBENCH_LIB \
 DBENCH_SRC=$DBENCH_SRC \
 TESTNAME=$TESTNAME \
 DBENCH_LIB=$DBENCH_LIB \
 DBENCH_SRC=$DBENCH_SRC \
+CLIENT_COUNT=$((CLIENTCOUNT - 1)) \
 LFS=$LFS \
 run_${load}.sh" &
     local ppid=$!
 LFS=$LFS \
 run_${load}.sh" &
     local ppid=$!