From 9085c8d6563fd4fd49eea653c8a0d38cfbd0751b Mon Sep 17 00:00:00 2001 From: yangsheng Date: Tue, 26 Feb 2013 16:40:24 +0800 Subject: [PATCH] LU-951 test: waiting import state in fail(). 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 Change-Id: I55ccb0fd30d69eae651978804ef1e303d9939a71 Reviewed-on: http://review.whamcloud.com/5531 Reviewed-by: Jian Yu Tested-by: Hudson Tested-by: Maloo Reviewed-by: Johann Lombardi --- lustre/tests/test-framework.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index e21f50d..6216ad6 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 -- 1.8.3.1