From: wangdi Date: Tue, 20 Nov 2012 18:09:22 +0000 (-0800) Subject: LU-2280 tests: wait osc import to be FULL after sanityn 34. X-Git-Tag: 2.3.62~27 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a427873beaa99aaede1845869673a9a9678fc637 LU-2280 tests: wait osc import to be FULL after sanityn 34. 1. It should wait osc import to be FULL before proceeding to the following test. 2. fixes in osc_wait_import_event for waiting multiple osc imports. Signed-off-by: Wang Di Change-Id: Ia054264954a6e0aacadc7c8062c2f353cd87f834 Reviewed-on: http://review.whamcloud.com/4468 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index f1c326f..dcb3c0c 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -957,10 +957,21 @@ get_ost_lock_timeouts() { echo $locks } +cleanup_34() { + local i + trap 0 + do_nodes $(comma_list $(osts_nodes)) \ + "lctl set_param -n fail_loc=0 2>/dev/null || true" + for i in $(seq $OSTCOUNT); do + wait_osc_import_state client ost$i FULL + done +} + test_34() { #16129 local OPER local lock_in local lock_out + trap cleanup_34 EXIT RETURN for OPER in notimeout timeout ; do rm $DIR1/$tfile 2>/dev/null lock_in=$(get_ost_lock_timeouts) @@ -999,6 +1010,7 @@ test_34() { #16129 fi fi done + cleanup_34 } run_test 34 "no lock timeout under IO" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index c351707..c7e03d0 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -5068,14 +5068,36 @@ wait_osc_import_state() { local expected=$3 local ost=$(get_osc_import_name $facet $ost_facet) - local param="osc.${ost}.ost_server_uuid" + local param="osc.${ost}.ost_server_uuid" + local i=0 # 1. wait the deadline of client 1st request (it could be skipped) # 2. wait the deadline of client 2nd request local maxtime=$(( 2 * $(request_timeout $facet))) + #During setup time, the osc might not be setup, it need wait + #until list_param can return valid value. And also if there + #are mulitple osc entries we should list all of them before + #go to wait. + local params=$($LCTL list_param $param || true) + while [ -z "$params" ]; do + if [ $i -ge $maxtime ]; then + echo "can't get $param by list_param in $maxtime secs" + if [[ $facet != client* ]]; then + echo "Go with $param directly" + params=$param + break + else + return 1 + fi + fi + sleep 1 + i=$((i + 1)) + params=$($LCTL list_param $param || true) + done + if ! do_rpc_nodes "$(facet_host $facet)" \ - _wait_import_state $expected $param $maxtime; then + wait_import_state $expected "$params" $maxtime; then error "import is not in ${expected} state" return 1 fi