Whamcloud - gitweb
Revert "b=20647 Ensure all needed pids exits before failover in test set 53"
authorRobert Read <rread@sun.com>
Thu, 15 Apr 2010 23:06:54 +0000 (16:06 -0700)
committerRobert Read <rread@sun.com>
Thu, 15 Apr 2010 23:06:54 +0000 (16:06 -0700)
The "Cleanup wait_..._import_state function" part of this patch appears to cause
bug 22594.

This reverts commit 8f6d85eebc312b64d8e8a35b0be3ae137a50a45c.

lustre/tests/replay-single.sh
lustre/tests/test-framework.sh

index 7dcad42..61a6cd2 100755 (executable)
@@ -1170,9 +1170,6 @@ test_53c() {
         kill -USR1 $close_pid
         cancel_lru_locks mdc    # force the close
 
-        #bz20647: make sure all pids are exists before failover
-        [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
-        [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
         replay_barrier_nodf $SINGLEMDS
         fail_nodf $SINGLEMDS
         wait $open_pid || return 1
@@ -1266,9 +1263,6 @@ test_53f() {
         kill -USR1 $close_pid
         cancel_lru_locks mdc    # force the close
 
-        #bz20647: make sure all pids are exists before failover
-        [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
-        [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
         replay_barrier_nodf $SINGLEMDS
         fail_nodf $SINGLEMDS
         wait $open_pid || return 1
@@ -1301,11 +1295,8 @@ test_53g() {
         do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
         kill -USR1 $close_pid
         cancel_lru_locks mdc    # force the close
-        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-        #bz20647: make sure all pids are exists before failover
-        [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
-        [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
+        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
         replay_barrier_nodf $SINGLEMDS
         fail_nodf $SINGLEMDS
         wait $open_pid || return 1
@@ -1339,9 +1330,6 @@ test_53h() {
         cancel_lru_locks mdc    # force the close
         sleep 1
 
-        #bz20647: make sure all pids are exists before failover
-        [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
-        [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
         replay_barrier_nodf $SINGLEMDS
         fail_nodf $SINGLEMDS
         wait $open_pid || return 1
index 10edcd3..904a89a 100644 (file)
@@ -3303,13 +3303,12 @@ get_osc_import_name() {
 }
 
 wait_import_state () {
-    local facet=$1
-    local expected=$2
-    local CONN_PROC=$3
+    local expected=$1
+    local CONN_PROC=$2
     local CONN_STATE
     local i=0
 
-    CONN_STATE=$(do_facet $facet $LCTL get_param -n $CONN_PROC | awk '/state/ {print $2}')
+    CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
     while [ "${CONN_STATE}" != "${expected}" ]; do
         if [ "${expected}" == "DISCONN" ]; then
             # for disconn we can check after proc entry is removed
@@ -3322,7 +3321,7 @@ wait_import_state () {
         [ $i -ge $(($TIMEOUT * 3 / 2)) ] && \
             error "can't put import for $CONN_PROC into ${expected} state" && return 1
         sleep 1
-        CONN_STATE=$(do_facet $facet $LCTL get_param -n $CONN_PROC | awk '/state/ {print $2}')
+        CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
         i=$(($i + 1))
     done
 
@@ -3335,26 +3334,33 @@ wait_osc_import_state() {
     local ost_facet=$2
     local expected=$3
     local ost=$(get_osc_import_name $facet $ost_facet)
-    local CONN_PROC="osc.${ost}.import"
+    local CONN_PROC
+    local CONN_STATE
+    local i=0
 
-    wait_import_state $facet $expected $CONN_PROC || return 1
+    CONN_PROC="osc.${ost}.ost_server_uuid"
+    CONN_STATE=$(do_facet $facet lctl get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+    while [ "${CONN_STATE}" != "${expected}" ]; do
+        if [ "${expected}" == "DISCONN" ]; then 
+            # for disconn we can check after proc entry is removed
+            [ "x${CONN_STATE}" == "x" ] && return 0
+            #  with AT we can have connect request timeout ~ reconnect timeout
+            # and test can't see real disconnect
+            [ "${CONN_STATE}" == "CONNECTING" ] && return 0
+        fi
+        # disconnect rpc should be wait not more obd_timeout
+        [ $i -ge $(($TIMEOUT * 3 / 2)) ] && \
+            error "can't put import for ${ost}(${ost_facet}) into ${expected} state" && return 1
+        sleep 1
+        CONN_STATE=$(do_facet $facet lctl get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+        i=$(($i + 1))
+    done
+
+    log "${ost_facet} now in ${CONN_STATE} state"
     return 0
 }
-
 get_clientmdc_proc_path() {
-    local mdc=$(convert_facet2label $1)
-
-    echo "${mdc}-mdc-*"
-}
-
-wait_mdc_import_state() {
-    local facet=$1
-    local expected=$2
-    local mdc=$(get_clientmdc_proc_path $facet)
-    local CONN_PROC="mdc.${mdc}.import"
-
-    wait_import_state client $expected $CONN_PROC || return 1
-    return 0
+    echo "${1}-mdc-*"
 }
 
 do_rpc_nodes () {
@@ -3366,29 +3372,24 @@ do_rpc_nodes () {
     do_nodesv $list "PATH=$RPATH sh rpc.sh $@ "
 }
 
-wait_client_import_state () {
-    local facet=$1
-    local expected=$2
+wait_clients_import_state () {
+    local list=$1
+    local facet=$2
+    local expected=$3
     shift
 
+    local label=$(convert_facet2label $facet)
+    local proc_path
     case $facet in
-        ost* ) wait_osc_import_state client $facet $expected || return 1;;
-        mds* ) wait_mdc_import_state $facet $expected || return 1 ;;
-           * ) error "unknown facet!"
-               return 1 ;;
+        ost* ) proc_path="osc.$(get_clientosc_proc_path $label).ost_server_uuid" ;;
+        mds* ) proc_path="mdc.$(get_clientmdc_proc_path $label).mds_server_uuid" ;;
+        *) error "unknown facet!" ;;
     esac
-    return 0
-}
-
-wait_clients_import_state () {
-    local list=$1
-    shift
 
-    if ! do_rpc_nodes $list wait_client_import_state "$@"; then
-        error "import is not in expected state"
+    if ! do_rpc_nodes $list wait_import_state $expected $proc_path; then
+        error "import is not in ${expected} state"
         return 1
     fi
-    return 0
 }
 
 oos_full() {