Whamcloud - gitweb
LU-951 test: waiting import state in fail().
authoryangsheng <yang.sheng@intel.com>
Tue, 26 Feb 2013 08:40:24 +0000 (16:40 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 15 Mar 2013 20:27:22 +0000 (16:27 -0400)
Anyway, There still has a rare chance that the request meet
a invalid import after fail() return. So we should waiting
import restore to a certain state and doing next operation.
Add wait_import_state_mount() to check import state while
client has a mount point.

Signed-off-by: yang sheng <yang.sheng@intel.com>
Change-Id: I55ccb0fd30d69eae651978804ef1e303d9939a71
Reviewed-on: http://review.whamcloud.com/5531
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/tests/test-framework.sh

index e21f50d..6216ad6 100644 (file)
@@ -2181,8 +2181,12 @@ ost_evict_client() {
 }
 
 fail() {
-    facet_failover $* || error "failover: $?"
-    clients_up || error "post-failover df: $?"
+       local facets=$1
+       local clients=${CLIENTS:-$HOSTNAME}
+
+       facet_failover $* || error "failover: $?"
+       wait_clients_import_state "$clients" "$facets" FULL
+       clients_up || error "post-failover df: $?"
 }
 
 fail_nodf() {
@@ -4926,7 +4930,7 @@ convert_facet2label() {
 }
 
 get_clientosc_proc_path() {
-    echo "${1}-osc-[^M]*"
+    echo "${1}-osc-*"
 }
 
 get_lustre_version () {
@@ -4990,7 +4994,7 @@ _wait_import_state () {
     local CONN_STATE
     local i=0
 
-    CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+       CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2 | uniq)
     while [ "${CONN_STATE}" != "${expected}" ]; do
         if [ "${expected}" == "DISCONN" ]; then
             # for disconn we can check after proc entry is removed
@@ -5003,7 +5007,8 @@ _wait_import_state () {
             error "can't put import for $CONN_PROC into ${expected} state after $i sec, have ${CONN_STATE}" && \
             return 1
         sleep 1
-        CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+       # Add uniq for multi-mount case
+       CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2 | uniq)
         i=$(($i + 1))
     done
 
@@ -5022,6 +5027,14 @@ wait_import_state() {
     done
 }
 
+wait_import_state_mount() {
+       if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then
+               return 0
+       fi
+
+       wait_import_state $*
+}
+
 # One client request could be timed out because server was not ready
 # when request was sent by client.
 # The request timeout calculation details :
@@ -5142,7 +5155,7 @@ wait_clients_import_state () {
     local params=$(expand_list $params $proc_path)
     done
 
-       if ! do_rpc_nodes "$list" wait_import_state $expected $params; then
+       if ! do_rpc_nodes "$list" wait_import_state_mount $expected $params; then
                error "import is not in ${expected} state"
                return 1
        fi