Whamcloud - gitweb
LU-2280 tests: wait osc import to be FULL after sanityn 34.
authorwangdi <di.wang@whamcloud.com>
Tue, 20 Nov 2012 18:09:22 +0000 (10:09 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 25 Feb 2013 13:08:07 +0000 (08:08 -0500)
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 <di.wang@intel.com>
Change-Id: Ia054264954a6e0aacadc7c8062c2f353cd87f834
Reviewed-on: http://review.whamcloud.com/4468
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh

index f1c326f..dcb3c0c 100644 (file)
@@ -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"
 
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