set -e
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
. $LUSTRE/tests/test-framework.sh
+init_test_env $@
-export PATH=$LUSTRE/utils:$PATH
-LFS=${LFS:-lfs}
-LCTL=${LCTL:-lctl}
MOUNT=${MOUNT:-$1}
MOUNT=${MOUNT:-/mnt/lustre}
MOUNT2=${MOUNT2:-$2}
MOUNT2=${MOUNT2:-${MOUNT}2}
OOS=$MOUNT/oosfile
OOS2=$MOUNT2/oosfile2
-TMP=${TMP:-/tmp}
LOG=$TMP/$(basename $0 .sh).log
LOG2=${LOG}2
sync; sleep 1; sync # to ensure we get up-to-date statfs info
-STRIPECOUNT=`$LCTL get_param -n lov.*.activeobd | head -n 1`
-ORIGFREE=`$LCTL get_param -n llite.*.kbytesavail | head -n 1`
+STRIPECOUNT=$($LCTL get_param -n lov.*.activeobd | head -n 1)
+ORIGFREE=$($LCTL get_param -n llite.*.kbytesavail | head -n 1)
MAXFREE=${MAXFREE:-$((400000 * $STRIPECOUNT))}
echo STRIPECOUNT=$STRIPECOUNT ORIGFREE=$ORIGFREE MAXFREE=$MAXFREE
if [ $ORIGFREE -gt $MAXFREE ]; then
# flush cache to OST(s) so avail numbers are correct
sync; sleep 1 ; sync
-for OSC in `$LCTL get_param -N osc.*-osc-*.kbytesavail | cut -d"." -f1-2`; do
- AVAIL=`$LCTL get_param -n $OSC.kbytesavail`
- GRANT=$((`$LCTL get_param -n $OSC.cur_grant_bytes` / 1024))
- echo -n "$(echo $OSC | cut -d"." -f2) avl=$AVAIL grnt=$GRANT diff=$(($AVAIL - $GRANT))"
- [ $(($AVAIL - $GRANT)) -lt 400 ] && OSCFULL=full && echo -n " FULL"
- echo " "
-done
-
-# FIXME - This test reports false failures
-# The grants from multiple clients need to be added together and compared
-# against the kbytesavail.
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/kbytesavail:16248
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04200/cur_grant_bytes:4313088
-#/proc/fs/lustre/osc/lustre-OST0001-osc-c3b04e00/cur_grant_bytes:12660736
-
-if [ -z "$OSCFULL" ]; then
+if ! oos_full; then
echo "no OSTs are close to full"
- $LCTL get_param "osc.*-osc-*.kbytesavail"
- $LCTL get_param "osc.*-osc-*.cur*"
SUCCESS=0
fi