Whamcloud - gitweb
LU-4517 tests: get params directly in _wait_osc_import_state 89/8989/3
authorEmoly Liu <emoly.liu@intel.com>
Sun, 26 Jan 2014 02:27:20 +0000 (10:27 +0800)
committerAndreas Dilger <andreas.dilger@intel.com>
Wed, 29 Jan 2014 01:04:27 +0000 (01:04 +0000)
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 <emoly.liu@intel.com>
Change-Id: Idf5989f53d050edcb69690b7f24a6e86df233bef
Reviewed-on: http://review.whamcloud.com/8989
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/tests/test-framework.sh

index 48dd82e..0cab0c6 100644 (file)
@@ -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"