From ef4d3e56c1f4299353e36ed5b8d8d7088b2deda5 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Tue, 26 Feb 2013 16:40:24 +0800 Subject: [PATCH] LU-2864 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: I0b4a79c877bd6f240020d629fd672ba87ee6c99b Reviewed-on: http://review.whamcloud.com/5743 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index b1f6693..6691ddb 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1863,8 +1863,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() { @@ -4217,7 +4221,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 @@ -4230,7 +4234,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 @@ -4249,6 +4254,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 : @@ -4348,7 +4361,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