From: yangsheng Date: Thu, 4 Aug 2011 03:36:23 +0000 (+0800) Subject: LU-427 test: Test failure on test suite lfsck X-Git-Tag: 2.1.56~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=00bea252bac5b682d48911eb4f37c6ec87aca3f1 LU-427 test: Test failure on test suite lfsck - Reset $MDSDB & $OSTDB in generate_db(). Else they will stale if user redefine $SHARED_DIRECTORY. - Add a function check_shared_dir() to ensure $SHARED_DIRECTORY is shared among tests nodes. Change-Id: Idf2a3d75e46c4cf768419adfea627511c24c495c Signed-off-by: Yang Sheng Reviewed-on: http://review.whamcloud.com/1180 Reviewed-by: Yu Jian Tested-by: Hudson Tested-by: Maloo Reviewed-by: Wei Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 1cbf814..2364b49 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -131,3 +131,7 @@ MPIRUN=$(which mpirun 2>/dev/null) || true MPI_USER=${MPI_USER:-mpiuser} SHARED_DIR_LOGS=${SHARED_DIR_LOGS:-""} +# This is used by a small number of tests to share state between the client +# running the tests, or in some cases between the servers (e.g. lfsck.sh). +# It needs to be a non-lustre filesystem that is available on all the nodes. +SHARED_DIRECTORY=${SHARED_DIRECTORY:-""} # bug 17839 comment 65 diff --git a/lustre/tests/cfg/ncli.sh b/lustre/tests/cfg/ncli.sh index a8c2885..d9afd5d 100644 --- a/lustre/tests/cfg/ncli.sh +++ b/lustre/tests/cfg/ncli.sh @@ -15,11 +15,6 @@ init_clients_lists # default boulder cluster iozone location export PATH=/opt/iozone/bin:$PATH -# This is used by a small number of tests to share state between the client -# running the tests, or in some cases between the servers (e.g. lfsck.sh). -# It needs to be a non-lustre filesystem that is available on all the nodes. -SHARED_DIRECTORY=${SHARED_DIRECTORY:-""} # bug 17839 comment 65 - LOADS=${LOADS:-"dd tar dbench iozone"} for i in $LOADS; do [ -f $LUSTRE/tests/run_${i}.sh ] || \ diff --git a/lustre/tests/recovery-double-scale.sh b/lustre/tests/recovery-double-scale.sh index 5c18183..6bf0b32 100644 --- a/lustre/tests/recovery-double-scale.sh +++ b/lustre/tests/recovery-double-scale.sh @@ -32,6 +32,9 @@ set -x [ "$SHARED_DIRECTORY" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Empty SHARED_DIRECTORY" && exit 0; } +check_shared_dir $SHARED_DIRECTORY || + error "$SHARED_DIRECTORY isn't a shared directory" + [ -n "$CLIENTS" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Need two or more remote clients" && exit 0; } diff --git a/lustre/tests/recovery-mds-scale.sh b/lustre/tests/recovery-mds-scale.sh index 02ec4ce..0f88612 100644 --- a/lustre/tests/recovery-mds-scale.sh +++ b/lustre/tests/recovery-mds-scale.sh @@ -30,6 +30,9 @@ set -x [ "$SHARED_DIRECTORY" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Empty SHARED_DIRECTORY" && exit 0; } +check_shared_dir $SHARED_DIRECTORY || + error "$SHARED_DIRECTORY isn't a shared directory" + [ -n "$CLIENTS" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Need two or more remote clients" && exit 0; } diff --git a/lustre/tests/recovery-random-scale.sh b/lustre/tests/recovery-random-scale.sh index 3d995f2..2ee2ea8 100644 --- a/lustre/tests/recovery-random-scale.sh +++ b/lustre/tests/recovery-random-scale.sh @@ -34,6 +34,9 @@ set -x [ "$SHARED_DIRECTORY" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Empty SHARED_DIRECTORY" && exit 0; } +check_shared_dir $SHARED_DIRECTORY || + error "$SHARED_DIRECTORY isn't a shared directory" + [ -n "$CLIENTS" ] || \ { FAIL_ON_ERROR=true skip_env "$0 Need two or more remote clients" && exit 0; } diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index cca6f0c..4c52a29 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -130,13 +130,6 @@ init_test_env() { export LFSCK_ALWAYS=${LFSCK_ALWAYS:-"no"} # check fs after each test suite export FSCK_MAX_ERR=4 # File system errors left uncorrected - # This is used by a small number of tests to share state between the client - # running the tests, or in some cases between the servers (e.g. lfsck.sh). - # It needs to be a non-lustre filesystem that is available on all the nodes. - export SHARED_DIRECTORY=${SHARED_DIRECTORY:-"/tmp"} - export MDSDB=${MDSDB:-$SHARED_DIRECTORY/mdsdb} - export OSTDB=${OSTDB:-$SHARED_DIRECTORY/ostdb} - #[ -d /r ] && export ROOT=${ROOT:-/r} export TMP=${TMP:-$ROOT/tmp} export TESTSUITELOG=${TMP}/${TESTSUITE}.log @@ -2644,24 +2637,29 @@ run_e2fsck() { return 0 } +# verify a directory is shared among nodes. +check_shared_dir() { + local dir=$1 + + [ -z "$dir" ] && return 1 + do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $dir + check_write_access $dir || return 1 + return 0 +} + # Run e2fsck on MDT and OST(s) to generate databases used for lfsck. generate_db() { local i local ostidx local dev - local tmp_file - [ $MDSCOUNT -eq 1 ] || error "CMD is not supported" - tmp_file=$(mktemp -p $SHARED_DIRECTORY || - error "fail to create file in $SHARED_DIRECTORY") + check_shared_dir $SHARED_DIRECTORY || + error "$SHARED_DIRECTORY isn't a shared directory" - # make sure everything gets to the backing store - local list=$(comma_list $CLIENTS $(facet_host $SINGLEMDS) $(osts_nodes)) - do_nodes $list "sync; sleep 2; sync" + export MDSDB=$SHARED_DIRECTORY/mdsdb + export OSTDB=$SHARED_DIRECTORY/ostdb - do_nodes $list ls $tmp_file || \ - error "$SHARED_DIRECTORY is not a shared directory" - rm $tmp_file + [ $MDSCOUNT -eq 1 ] || error "CMD is not supported" run_e2fsck $(mdts_nodes) $MDTDEV "--mdsdb $MDSDB" @@ -4632,6 +4630,7 @@ check_write_access() { return 1 fi done + rm -f $dir/node.*.yml return 0 } @@ -4646,8 +4645,7 @@ init_logging() { mkdir -p $LOGDIR init_clients_lists - do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $LOGDIR - if check_write_access $LOGDIR; then + if check_shared_dir $LOGDIR; then touch $LOGDIR/shared echo "Logging to shared log directory: $LOGDIR" else