From 3b524b627b87ac0f1355658dbbe2e4a16cda122b Mon Sep 17 00:00:00 2001 From: grev Date: Tue, 15 Sep 2009 07:46:24 +0000 Subject: [PATCH] b=20237 i=Manoj.Joseph i=Robert.Read gather and archive the logs --- lustre/tests/cfg/local.sh | 2 ++ lustre/tests/recovery-mds-scale.sh | 16 +++++++++++++-- lustre/tests/test-framework.sh | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index c4baef8..7b6436a 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -124,3 +124,5 @@ FAIL_ON_ERROR=${FAIL_ON_ERROR:-true} MPIRUN=$(which mpirun 2>/dev/null) || true MPI_USER=${MPI_USER:-mpiuser} +SHARED_DIR_LOGS=${SHARED_DIR_LOGS:-""} + diff --git a/lustre/tests/recovery-mds-scale.sh b/lustre/tests/recovery-mds-scale.sh index 1c7cc84..675988c 100644 --- a/lustre/tests/recovery-mds-scale.sh +++ b/lustre/tests/recovery-mds-scale.sh @@ -15,8 +15,11 @@ init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} -TESTSUITELOG=${TESTSUITELOG:-$TMP/recovery-mds-scale} +TESTSUITELOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh)} DEBUGLOG=$TESTSUITELOG.debug + +cleanup_logs + exec 2>$DEBUGLOG echo "--- env ---" >&2 env >&2 @@ -28,7 +31,7 @@ set -x [ -n "$CLIENTS" ] || { skip "$0 Need two or more remote clients" && exit 0; } [ $CLIENTCOUNT -ge 3 ] || \ - { skip "$0 Need two or more clients, have $CLIENTCOUNT" && exit 0; } + { skip "$0 Need two or more remote clients, have $CLIENTCOUNT" && exit 0; } END_RUN_FILE=${END_RUN_FILE:-$SHARED_DIRECTORY/end_run_file} LOAD_PID_FILE=${LOAD_PID_FILE:-$TMP/client-load.pid} @@ -145,6 +148,15 @@ Status: $result: rc=$rc" sleep 5 kill -9 $CLIENT_LOAD_PIDS || true fi + if [ $rc -ne 0 ]; then + # we are interested in only on failed clients and servers + local failedclients=$(cat $END_RUN_FILE | grep -v $0) + # FIXME: need ostfailover-s nodes also for FLAVOR=OST + local product=$(gather_logs $(comma_list $(osts_nodes) \ + $(mdts_nodes) $mdsfailover_HOST $failedclients)) + echo logs files $product + fi + [ $rc -eq 0 ] && zconf_mount $(hostname) $MOUNT exit $rc diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 7111182..9f0bac0 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -3014,3 +3014,45 @@ oos_full() { done return $OSCFULL } + +gather_logs () { + local list=$1 + + local ts=$(date +%s) + + # bug 20237, comment 11 + # It would also be useful to provide the option + # of writing the file to an NFS directory so it doesn't need to be copied. + local tmp=$TMP + local docp=true + [ -d "$SHARED_DIR_LOGS" ] && tmp=$SHARED_DIR_LOGS && docp=false + + # dump lustre logs, dmesg + do_nodes $list "log=$tmp/\\\$(hostname)-debug-$ts.log ; +lctl dk \\\$log >/dev/null; +log=$tmp/\\\$(hostname)-dmesg-$ts.log; +dmesg > \\\$log; " + + # FIXME: does it make sense to collect the logs for $ts only, but all + # TESTSUITE logs? + # rsync $TMP/*${TESTSUITE}* to gather the logs dumped by error fn + local logs=$TMP/'*'${TESTSUITE}'*' + if $docp; then + logs=$logs' '$tmp/'*'$ts'*' + fi + for node in ${list//,/ }; do + rsync -az $node:"$logs" $TMP + done + + local archive=$TMP/${TESTSUITE}-$ts.tar.bz2 + tar -jcf $archive $tmp/*$ts* $TMP/*${TESTSUITE}* + + echo $archive +} + +cleanup_logs () { + local list=${1:-$(comma_list $(nodes_list))} + + [ -n ${TESTSUITE} ] && do_nodes $list "rm -f $TMP/*${TESTSUITE}*" || true +} + -- 1.8.3.1