From 938947f037ee65bb695fcc4509817463842e57fa Mon Sep 17 00:00:00 2001 From: Li Wei Date: Wed, 30 May 2012 21:49:09 +0800 Subject: [PATCH 1/1] LU-1415 tests: Adapt oos to the new grant and osd-zfs behavior This was originally developed by Johann Lombardi under ORI-151 and ORI-398. See http://review.whamcloud.com/1545 and http://review.whamcloud.com/1665. Change-Id: If778df1d672e2adb182cb801036aaef950d80af4 Whamcloud-bug-id: ORI-151 Whamcloud-bug-id: ORI-398 Signed-off-by: Li Wei Reviewed-on: http://review.whamcloud.com/2978 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Johann Lombardi Reviewed-by: Niu Yawei --- lustre/tests/oos.sh | 10 ++++++---- lustre/tests/test-framework.sh | 38 ++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/lustre/tests/oos.sh b/lustre/tests/oos.sh index c547b63..5d6a161 100755 --- a/lustre/tests/oos.sh +++ b/lustre/tests/oos.sh @@ -46,7 +46,11 @@ oos_full || true # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs $LFS setstripe $OOS -c $STRIPECOUNT -if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 100)) bs=1k 2> $LOG; then +# add 20% of margin since the metadata overhead estimated in bavail might be +# too aggressive and we might be able to write more than reported initially +# by statfs. +echo dd size $((ORIGFREE * 120 / 100))kB +if dd if=/dev/zero of=$OOS count=$((ORIGFREE * 120 / 100)) bs=1k 2> $LOG; then echo "ERROR: dd did not fail" SUCCESS=0 fi @@ -81,10 +85,8 @@ fi #$LCTL debug_daemon stop -echo LOG file -cat $LOG +[ $SUCCESS != 0 ] && echo LOG file && sed "s/^/LOG: /" $LOG rm -f $OOS -sync; sleep 1; sync sync; sleep 3; sync diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index fe080f5..a7c660a 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -4566,20 +4566,30 @@ wait_clients_import_state () { } oos_full() { - local -a AVAILA - local -a GRANTA - local OSCFULL=1 - AVAILA=($(do_nodes $(comma_list $(osts_nodes)) \ - $LCTL get_param obdfilter.*.kbytesavail)) - GRANTA=($(do_nodes $(comma_list $(osts_nodes)) \ - $LCTL get_param -n obdfilter.*.tot_granted)) - for ((i=0; i<${#AVAILA[@]}; i++)); do - local -a AVAIL1=(${AVAILA[$i]//=/ }) - GRANT=$((${GRANTA[$i]}/1024)) - echo -n $(echo ${AVAIL1[0]} | cut -d"." -f2) avl=${AVAIL1[1]} grnt=$GRANT diff=$((AVAIL1[1] - GRANT)) - [ $((AVAIL1[1] - GRANT)) -lt 400 ] && OSCFULL=0 && echo " FULL" || echo - done - return $OSCFULL + local -a AVAILA + local -a GRANTA + local -a TOTALA + local OSCFULL=1 + AVAILA=($(do_nodes $(comma_list $(osts_nodes)) \ + $LCTL get_param obdfilter.*.kbytesavail)) + GRANTA=($(do_nodes $(comma_list $(osts_nodes)) \ + $LCTL get_param -n obdfilter.*.tot_granted)) + TOTALA=($(do_nodes $(comma_list $(osts_nodes)) \ + $LCTL get_param -n obdfilter.*.kbytestotal)) + for ((i=0; i<${#AVAILA[@]}; i++)); do + local -a AVAIL1=(${AVAILA[$i]//=/ }) + local -a TOTAL=(${TOTALA[$i]//=/ }) + GRANT=$((${GRANTA[$i]}/1024)) + # allow 1% of total space in bavail because of delayed + # allocation with ZFS which might release some free space after + # txg commit. For small devices, we set a mininum of 8MB + local LIMIT=$((${TOTAL} / 100 + 8000)) + echo -n $(echo ${AVAIL1[0]} | cut -d"." -f2) avl=${AVAIL1[1]} \ + grnt=$GRANT diff=$((AVAIL1[1] - GRANT)) limit=${LIMIT} + [ $((AVAIL1[1] - GRANT)) -lt $LIMIT ] && OSCFULL=0 && \ + echo " FULL" || echo + done + return $OSCFULL } pool_list () { -- 1.8.3.1