Whamcloud - gitweb
LU-427 test: Test failure on test suite lfsck
authoryangsheng <ys@whamcloud.com>
Thu, 4 Aug 2011 03:36:23 +0000 (11:36 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 16 Feb 2012 18:15:23 +0000 (13:15 -0500)
- 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 <ys@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1180
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/cfg/local.sh
lustre/tests/cfg/ncli.sh
lustre/tests/recovery-double-scale.sh
lustre/tests/recovery-mds-scale.sh
lustre/tests/recovery-random-scale.sh
lustre/tests/test-framework.sh

index 1cbf814..2364b49 100644 (file)
@@ -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
index a8c2885..d9afd5d 100644 (file)
@@ -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 ] || \
index 5c18183..6bf0b32 100644 (file)
@@ -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; }
 
index 02ec4ce..0f88612 100644 (file)
@@ -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; }
 
index 3d995f2..2ee2ea8 100644 (file)
@@ -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; }
 
index cca6f0c..4c52a29 100644 (file)
@@ -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