Whamcloud - gitweb
LU-2280 tests: wait osc import to be FULL after sanityn 34.
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index c351707..c7e03d0 100644 (file)
@@ -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