From f244bec5ab5bd9b312751c0352a3d99c7e2271e7 Mon Sep 17 00:00:00 2001 From: Emoly Liu Date: Sun, 26 Jan 2014 10:27:20 +0800 Subject: [PATCH] LU-4517 tests: get params directly in _wait_osc_import_state In _wait_osc_import_state(), if the facet is not a client node, go to get osc.*.ost_server_uuid params directly and quickly, without waiting $maxtime seconds. Signed-off-by: Emoly Liu Change-Id: Idf5989f53d050edcb69690b7f24a6e86df233bef Reviewed-on: http://review.whamcloud.com/8989 Reviewed-by: Jian Yu Reviewed-by: John L. Hammond Tested-by: Jenkins Reviewed-by: Andreas Dilger --- lustre/tests/test-framework.sh | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 48dd82e..0cab0c6 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -5645,39 +5645,34 @@ request_timeout () { } _wait_osc_import_state() { - local facet=$1 - local ost_facet=$2 - local expected=$3 - local ost=$(get_osc_import_name $facet $ost_facet) - + local facet=$1 + local ost_facet=$2 + local expected=$3 + local ost=$(get_osc_import_name $facet $ost_facet) local param="osc.${ost}.ost_server_uuid" + local params=$param 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 2>/dev/null || 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 + # 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))) + + if [[ $facet == client* ]]; then + # 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. + params=$($LCTL list_param $param 2>/dev/null || true) + while [ -z "$params" ]; do + if [ $i -ge $maxtime ]; then + echo "can't get $param in $maxtime secs" return 1 fi - fi - sleep 1 - i=$((i + 1)) - params=$($LCTL list_param $param 2>/dev/null || true) - done - + sleep 1 + i=$((i + 1)) + params=$($LCTL list_param $param 2>/dev/null || true) + done + fi if ! do_rpc_nodes "$(facet_active_host $facet)" \ wait_import_state $expected "$params" $maxtime; then error "import is not in ${expected} state" -- 1.8.3.1