#!/bin/bash
-# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
+# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
trap 'print_summary && touch $TF_FAIL && \
echo "test-framework exiting on error"' ERR
. $EXCEPT_LIST_FILE
fi
-[ -z "$MODPROBECONF" -a -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf
-[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
+# check config files for options in decreasing order of preference
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/lustre.conf ] &&
+ MODPROBECONF=/etc/modprobe.d/lustre.conf
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.d/Lustre ] &&
+ MODPROBECONF=/etc/modprobe.d/Lustre
+[ -z "$MODPROBECONF" -a -f /etc/modprobe.conf ] &&
+ MODPROBECONF=/etc/modprobe.conf
assert_DIR () {
local failed=""
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
- if [[ -z $LOGDIRSET ]]; then
- export LOGDIR=${LOGDIR:-${TMP}/test_logs/}/$(date +%s)
- export LOGDIRSET=true
- fi
+ export LOGDIR=${LOGDIR:-${TMP}/test_logs/$(date +%s)}
+ export TESTLOG_PREFIX=$LOGDIR/$TESTSUITE
+
export HOSTNAME=${HOSTNAME:-$(hostname -s)}
if ! echo $PATH | grep -q $LUSTRE/utils; then
export PATH=$LUSTRE/utils:$PATH
export PATH=$LUSTRE/tests/mpi:$PATH
fi
export RSYNC_RSH=${RSYNC_RSH:-rsh}
+
export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
[ ! -f "$LCTL" ] && export LCTL=$(which lctl)
export LFS=${LFS:-"$LUSTRE/utils/lfs"}
[ ! -f "$LFS" ] && export LFS=$(which lfs)
+ SETSTRIPE=${SETSTRIPE:-"$LFS setstripe"}
+ GETSTRIPE=${GETSTRIPE:-"$LFS getstripe"}
+
export L_GETIDENTITY=${L_GETIDENTITY:-"$LUSTRE/utils/l_getidentity"}
if [ ! -f "$L_GETIDENTITY" ]; then
if `which l_getidentity > /dev/null 2>&1`; then
[ ! -f "$TUNEFS" ] && export TUNEFS=$(which tunefs.lustre)
export CHECKSTAT="${CHECKSTAT:-"checkstat -v"} "
export LUSTRE_RMMOD=${LUSTRE_RMMOD:-$LUSTRE/scripts/lustre_rmmod}
- [ ! -f "$LUSTRE_RMMOD" ] && export LUSTRE_RMMOD=$(which lustre_rmmod 2> /dev/null)
+ [ ! -f "$LUSTRE_RMMOD" ] &&
+ export LUSTRE_RMMOD=$(which lustre_rmmod 2> /dev/null)
+ export LFS_MIGRATE=${LFS_MIGRATE:-$LUSTRE/scripts/lfs_migrate}
+ [ ! -f "$LFS_MIGRATE" ] &&
+ export LFS_MIGRATE=$(which lfs_migrate 2> /dev/null)
export FSTYPE=${FSTYPE:-"ldiskfs"}
export NAME=${NAME:-local}
export LGSSD=${LGSSD:-"$LUSTRE/utils/gss/lgssd"}
rm -f $TMP/*active
}
+version_code() {
+ # split arguments like "1.8.6-wc3" into "1", "8", "6", "wc3"
+ eval set -- $(tr "[:punct:]" " " <<< $*)
+
+ echo -n $((($1 << 16) | ($2 << 8) | $3))
+}
+
+export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//")
+export LINUX_VERSION_CODE=$(version_code ${LINUX_VERSION//\./ })
+
case `uname -r` in
2.4.*) EXT=".o"; USE_QUOTA=no; [ ! "$CLIENTONLY" ] && FSTYPE=ext3;;
*) EXT=".ko"; USE_QUOTA=yes;;
load_module obdclass/obdclass
load_module ptlrpc/ptlrpc
load_module ptlrpc/gss/ptlrpc_gss
- [ "$USE_QUOTA" = "yes" -a "$LQUOTA" != "no" ] && load_module quota/lquota $LQUOTAOPTS
load_module fld/fld
load_module fid/fid
load_module lmv/lmv
load_module lov/lov
load_module mgc/mgc
if ! client_only; then
- grep -q crc16 /proc/kallsyms || { modprobe crc16 2>/dev/null || true; }
- grep -q -w jbd /proc/kallsyms || { modprobe jbd 2>/dev/null || true; }
- grep -q -w jbd2 /proc/kallsyms || { modprobe jbd2 2>/dev/null || true; }
- [ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
+ SYMLIST=/proc/kallsyms
+ grep -q crc16 $SYMLIST || { modprobe crc16 2>/dev/null || true; }
+ grep -q -w jbd $SYMLIST || { modprobe jbd 2>/dev/null || true; }
+ grep -q -w jbd2 $SYMLIST || { modprobe jbd2 2>/dev/null || true; }
+ if [ "$FSTYPE" = "ldiskfs" ]; then
+ grep -q exportfs_decode_fh $SYMLIST ||
+ { modprobe exportfs 2> /dev/null || true; }
+ load_module ../ldiskfs/ldiskfs/ldiskfs
+ fi
+ [ "$USE_QUOTA" = "yes" -a "$LQUOTA" != "no" ] && load_module quota/lquota $LQUOTAOPTS
load_module mgs/mgs
load_module mds/mds
load_module mdd/mdd
load_module cmm/cmm
load_module osd-ldiskfs/osd_ldiskfs
load_module ost/ost
- load_module obdfilter/obdfilter
+ if [ "x$USE_OFD" = "xyes" ]; then
+ load_module ofd/ofd
+ else
+ load_module obdfilter/obdfilter
+ fi
fi
set_debug_size () {
local dz=${1:-$DEBUG_SIZE}
- local cpus=$(getconf _NPROCESSORS_CONF)
+
+ if [ -f /sys/devices/system/cpu/possible ]; then
+ local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
+ else
+ local cpus=$(getconf _NPROCESSORS_CONF)
+ fi
# bug 19944, adjust size to be -gt num_possible_cpus()
# promise 2MB for every cpu at least
set_default_debug () {
local debug=${1:-"$PTLDEBUG"}
- local subsystem_debug=${2:-"$SUBSYSTEM"}
+ local subsys=${2:-"$SUBSYSTEM"}
local debug_size=${3:-$DEBUG_SIZE}
- lctl set_param debug="$debug"
- lctl set_param subsystem_debug="${subsystem_debug# }"
+ [ -n "$debug" ] && lctl set_param debug="$debug" >/dev/null
+ [ -n "$subsys" ] && lctl set_param subsystem_debug="${subsys# }" >/dev/null
- set_debug_size $debug_size
- sync
+ [ -n "$debug_size" ] && set_debug_size $debug_size > /dev/null
}
set_default_debug_nodes () {
local nodes=$1
if [[ ,$nodes, = *,$HOSTNAME,* ]]; then
- nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
- set_default_debug
+ nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
+ set_default_debug
fi
[[ -n $nodes ]] && do_rpc_nodes $nodes set_default_debug \
- \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
+ \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
}
set_default_debug_facet () {
# Facet functions
mount_facets () {
- local facets=${1:-$(get_facets)}
- local facet
+ local facets=${1:-$(get_facets)}
+ local facet
- for facet in ${facets//,/ }; do
- mount_facet $facet || error "Restart of $facet failed!"
- done
+ for facet in ${facets//,/ }; do
+ mount_facet $facet
+ local RC=$?
+ [ $RC -eq 0 ] && continue
+
+ if [ "$TESTSUITE.$TESTNAME" = "replay-dual.test_0a" ]; then
+ skip "Restart of $facet failed!." && touch $LU482_FAILED
+ else
+ error "Restart of $facet failed!"
+ fi
+ return $RC
+ done
}
mount_facet() {
- local facet=$1
- shift
- local dev=$(facet_active $facet)_dev
- local opt=${facet}_opt
- local mntpt=$(facet_mntpt $facet)
-
- echo "Starting ${facet}: ${!opt} $@ ${!dev} $mntpt"
- do_facet ${facet} "mkdir -p $mntpt; mount -t lustre ${!opt} $@ ${!dev} $mntpt"
- RC=${PIPESTATUS[0]}
- if [ $RC -ne 0 ]; then
- echo "mount -t lustre $@ ${!dev} $mntpt"
- echo "Start of ${!dev} on ${facet} failed ${RC}"
+ local facet=$1
+ shift
+ local dev=$(facet_active $facet)_dev
+ local opt=${facet}_opt
+ local mntpt=$(facet_mntpt $facet)
+
+ echo "Starting ${facet}: ${!opt} $@ ${!dev} $mntpt"
+ # for testing LU-482 error handling in mount_facets() and test_0a()
+ if [ -f $TMP/test-lu482-trigger ]; then
+ RC=2
+ else
+ do_facet ${facet} "mkdir -p $mntpt; mount -t lustre ${!opt} \
+ $@ ${!dev} $mntpt"
+ RC=${PIPESTATUS[0]}
+ fi
+ if [ $RC -ne 0 ]; then
+ echo "Start of ${!dev} on ${facet} failed ${RC}"
else
set_default_debug_facet $facet
local rc=0
for mnt in $mnts ; do
do_nodes $nodes "running=\\\$(grep -c $mnt' ' /proc/mounts);
-mpts=\\\$(mount | grep -w -c $mnt);
+mpts=\\\$(mount | grep -c $mnt' ');
if [ \\\$running -ne \\\$mpts ]; then
echo \\\$(hostname) env are INSANE!;
exit 1;
exit \\\$rc" || return ${PIPESTATUS[0]}
echo "Started clients $clients: "
- do_nodes $clients "mount | grep -w $mnt"
+ do_nodes $clients "mount | grep $mnt' '"
set_default_debug_nodes $clients
do_nodes $clients "running=\\\$(grep -c $mnt' ' /proc/mounts);
if [ \\\$running -ne 0 ] ; then
echo Stopping client \\\$(hostname) $mnt opts:$force;
-lsof -t $mnt || need_kill=no;
+lsof $mnt || need_kill=no;
if [ "x$force" != "x" -a "x\\\$need_kill" != "xno" ]; then
pids=\\\$(lsof -t $mnt | sort -u);
if [ -n \\\"\\\$pids\\\" ]; then
kill -9 \\\$pids;
fi
fi;
-busy=\\\$(umount $force $mnt 2>&1 | grep -c "busy");
-if [ \\\$busy -ne 0 ] ; then
+while umount $force $mnt 2>&1 | grep -q "busy"; do
echo "$mnt is still busy, wait one second" && sleep 1;
- umount $force $mnt;
-fi
+done;
fi"
}
eval export ${var}=$load
do_node $client "PATH=$PATH MOUNT=$MOUNT ERRORS_OK=$ERRORS_OK \
- BREAK_ON_ERROR=$BREAK_ON_ERROR \
- END_RUN_FILE=$END_RUN_FILE \
- LOAD_PID_FILE=$LOAD_PID_FILE \
- TESTSUITELOG=$TESTSUITELOG \
- run_${load}.sh" &
- CLIENT_LOAD_PIDS="$CLIENT_LOAD_PIDS $!"
+BREAK_ON_ERROR=$BREAK_ON_ERROR \
+END_RUN_FILE=$END_RUN_FILE \
+LOAD_PID_FILE=$LOAD_PID_FILE \
+TESTLOG_PREFIX=$TESTLOG_PREFIX \
+TESTNAME=$TESTNAME \
+DBENCH_LIB=$DBENCH_LIB \
+DBENCH_SRC=$DBENCH_SRC \
+run_${load}.sh" &
+ local ppid=$!
log "Started client load: ${load} on $client"
+ # get the children process IDs
+ local pids=$(ps --ppid $ppid -o pid= | xargs)
+ CLIENT_LOAD_PIDS="$CLIENT_LOAD_PIDS $ppid $pids"
return 0
}
sleep 2
}
-# only for remote client
+# only for remote client
check_client_load () {
local client=$1
local var=$(node_var_name $client)_load
local TESTLOAD=run_${!var}.sh
ps auxww | grep -v grep | grep $client | grep -q "$TESTLOAD" || return 1
-
+
# bug 18914: try to connect several times not only when
# check ps, but while check_catastrophe also
local tries=3
if [ "$rc" != 0 ]; then
log "Client load failed to restart on node $client, rc=$rc"
# failure one client load means test fail
- # we do not need to check other
+ # we do not need to check other
return $rc
fi
else
fi
done
}
+
+# Start vmstat and save its process ID in a file.
+start_vmstat() {
+ local nodes=$1
+ local pid_file=$2
+
+ [ -z "$nodes" -o -z "$pid_file" ] && return 0
+
+ do_nodes $nodes \
+ "vmstat 1 > $TESTLOG_PREFIX.$TESTNAME.vmstat.\\\$(hostname -s).log \
+ 2>/dev/null </dev/null & echo \\\$! > $pid_file"
+}
+
+# Display the nodes on which client loads failed.
+print_end_run_file() {
+ local file=$1
+ local node
+
+ [ -s $file ] || return 0
+
+ echo "Found the END_RUN_FILE file: $file"
+ cat $file
+
+ # A client load will stop if it finds the END_RUN_FILE file.
+ # That does not mean the client load actually failed though.
+ # The first node in END_RUN_FILE is the one we are interested in.
+ read node < $file
+
+ if [ -n "$node" ]; then
+ local var=$(node_var_name $node)_load
+
+ local prefix=$TESTLOG_PREFIX
+ [ -n "$TESTNAME" ] && prefix=$prefix.$TESTNAME
+ local stdout_log=$prefix.run_${!var}_stdout.$node.log
+ local debug_log=$(echo $stdout_log | sed 's/\(.*\)stdout/\1debug/')
+
+ echo "Client load ${!var} failed on node $node:"
+ echo "$stdout_log"
+ echo "$debug_log"
+ fi
+}
+
+# Stop the process which had its PID saved in a file.
+stop_process() {
+ local nodes=$1
+ local pid_file=$2
+
+ [ -z "$nodes" -o -z "$pid_file" ] && return 0
+
+ do_nodes $nodes "test -f $pid_file &&
+ { kill -s TERM \\\$(cat $pid_file); rm -f $pid_file; }" || true
+}
+
+# Stop all client loads.
+stop_client_loads() {
+ local nodes=${1:-$CLIENTS}
+ local pid_file=$2
+
+ # stop the client loads
+ stop_process $nodes $pid_file
+
+ # clean up the processes that started them
+ [ -n "$CLIENT_LOAD_PIDS" ] && kill -9 $CLIENT_LOAD_PIDS 2>/dev/null || true
+}
# End recovery-scale functions
# verify that lustre actually cleaned up properly
local RESULT
local WAIT=0
- local sleep=5
+ local sleep=1
+ local print=10
while [ true ]; do
RESULT=$(do_node $node "$TEST")
if [ "$RESULT" == "$FINAL" ]; then
- echo "Updated after $WAIT sec: wanted '$FINAL' got '$RESULT'"
+ [ -z "$RESULT" -o $WAIT -le $sleep ] ||
+ echo "Updated after ${WAIT}s: wanted '$FINAL' got '$RESULT'"
return 0
fi
[ $WAIT -ge $MAX ] && break
- echo "Waiting $((MAX - WAIT)) secs for update"
+ [ $((WAIT % print)) -eq 0 ] &&
+ echo "Waiting $((MAX - WAIT)) secs for update"
WAIT=$((WAIT + sleep))
sleep $sleep
done
- echo "Update not seen after $MAX sec: wanted '$FINAL' got '$RESULT'"
+ echo "Update not seen after ${MAX}s: wanted '$FINAL' got '$RESULT'"
return 3
}
[ -z "$myPDSH" -o "$myPDSH" = "no_dsh" -o "$myPDSH" = "rsh" ] && \
echo "cannot run remote command on $rnodes with $myPDSH" && return 128
+ export FANOUT=$(get_node_count "${rnodes//,/ }")
if $VERBOSE; then
echo "CMD: $rnodes $@" >&2
$myPDSH $rnodes "$LCTL mark \"$@\"" > /dev/null 2>&1 || :
[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
mount_client $MOUNT
[ -n "$CLIENTS" ] && zconf_mount_clients $CLIENTS $MOUNT
+ clients_up
if [ "$MOUNT_2" ]; then
mount_client $MOUNT2
}
init_param_vars () {
- if ! remote_ost_nodsh && ! remote_mds_nodsh; then
- export MDSVER=$(do_facet $SINGLEMDS "lctl get_param version" | cut -d. -f1,2)
- export OSTVER=$(do_facet ost1 "lctl get_param version" | cut -d. -f1,2)
- export CLIVER=$(lctl get_param version | cut -d. -f 1,2)
- fi
-
remote_mds_nodsh ||
TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout")
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"
fi
if is_mounted $MOUNT; then
- [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]*
+ [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]* ||
+ error "remove sub-test dirs failed"
[ "$ENABLE_QUOTA" ] && restore_quota_type || true
fi
log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
+ mkdir -p $LOGDIR
# We need to dump the logs on all nodes
if $dump; then
gather_logs $(comma_list $(nodes_list))
echo
log_sub_test_begin test_${1}
- (run_one $1 "$2") 2>&1 | tee $test_log
+ (run_one $1 "$2") 2>&1 | tee -i $test_log
local RC=${PIPESTATUS[0]}
[ $RC -ne 0 ] && [ ! -f $LOGDIR/err ] && \
# get server grant
server_grant=`do_nodes $(comma_list $(osts_nodes)) \
- "$LCTL get_param -n obdfilter.${FSNAME}-OST*.tot_granted" | \
+ "$LCTL get_param -n obdfilter.${FSNAME}-OST*.tot_granted" |
awk '{total += $1} END{print total}'`
# check whether client grant == server grant
$LFS osts $2 | sed -ne "/${1}/s/\(.*\): .* .*$/\1/p"
}
+mdtuuid_from_index()
+{
+ $LFS mdts $2 | sed -ne "/^$1: /s/.* \(.*\) .*$/\1/p"
+}
+
remote_node () {
local node=$1
[ "$node" != "$(hostname)" ]
}
check_versions () {
- [ "$MDSVER" = "$CLIVER" -a "$OSTVER" = "$CLIVER" ]
+ [ "$(lustre_version_code client)" = "$(lustre_version_code $SINGLEMDS)" -a \
+ "$(lustre_version_code client)" = "$(lustre_version_code ost1)" ]
}
get_node_count() {
fi
}
-# $1 node
-# $2 file
-# $3 $RUNAS
-get_stripe_info() {
- local tmp_file
-
- stripe_size=0
- stripe_count=0
- stripe_index=0
- tmp_file=$(mktemp)
-
- do_facet $1 $3 lfs getstripe -v $2 > $tmp_file
-
- stripe_size=`awk '$1 ~ /size/ {print $2}' $tmp_file`
- stripe_count=`awk '$1 ~ /count/ {print $2}' $tmp_file`
- stripe_index=`awk '$1 ~ /stripe_offset/ {print $2}' $tmp_file`
- rm -f $tmp_file
-}
-
# CMD: determine mds index where directory inode presents
get_mds_dir () {
local dir=$1
get_lustre_version () {
local facet=${1:-"$SINGLEMDS"}
- do_facet $facet $LCTL get_param -n version | awk '/^lustre:/ {print $2}'
-}
-
-get_mds_version_major () {
- local facet=${1:-"$SINGLEMDS"}
- local version=$(get_lustre_version $facet)
- echo $version | awk -F. '{print $1}'
+ do_facet $facet $LCTL get_param -n version | awk '/^lustre:/ {print $2}'
}
-get_mds_version_minor () {
+lustre_version_code() {
local facet=${1:-"$SINGLEMDS"}
- local version=$(get_lustre_version $facet)
- echo $version | awk -F. '{print $2}'
+ version_code $(get_lustre_version $1)
}
# If the 2.0 MDS was mounted on 1.8 device, then the OSC and LOV names
# mdt osc: fsname-OSTXXXX-osc
mds_on_old_device() {
local mds=${1:-"$SINGLEMDS"}
- local major=$(get_mds_version_major $mds)
- local minor=$(get_mds_version_minor $mds)
- if [ $major -ge 2 ] || [ $major -eq 1 -a $minor -gt 8 ]; then
+ if [ $(lustre_version_code $mds) -gt $(version_code 1.9.0) ]; then
do_facet $mds "lctl list_param osc.$FSNAME-OST*-osc \
> /dev/null 2>&1" && return 0
fi
local mdt_label=$(convert_facet2label $mds_facet)
local mdt_index=$(echo $mdt_label | sed -e 's/^.*-//')
- local major=$(get_mds_version_major $mds_facet)
- local minor=$(get_mds_version_minor $mds_facet)
- if [ $major -le 1 -a $minor -le 8 ] || mds_on_old_device $mds_facet; then
+ if [ $(lustre_version_code $mds_facet) -le $(version_code 1.8.0) ] ||
+ mds_on_old_device $mds_facet; then
echo "${ost_label}-osc"
else
echo "${ost_label}-osc-${mdt_index}"
# the value depends on configure options, and it is not stored in /proc.
# obd_support.h:
# #define CONNECTION_SWITCH_MIN 5U
-# #ifndef CRAY_XT3
# #define INITIAL_CONNECT_TIMEOUT max(CONNECTION_SWITCH_MIN,obd_timeout/20)
-# #else
-# #define INITIAL_CONNECT_TIMEOUT max(CONNECTION_SWITCH_MIN,obd_timeout/2)
request_timeout () {
local facet=$1
echo destroy the created pools: ${!listvar}
for poolname in ${!listvar//,/ }; do
- destroy_pool $fsname.$poolname
+ destroy_pool $fsname.$poolname
done
}
local ts=$(date +%s)
local docp=true
+
+ if [[ ! -f "$YAML_LOG" ]]; then
+ # init_logging is not performed before gather_logs,
+ # so the $LOGDIR needs to be checked here
+ check_shared_dir $LOGDIR && touch $LOGDIR/shared
+ fi
+
[ -f $LOGDIR/shared ] && docp=false
-
+
# dump lustre logs, dmesg
- prefix="$LOGDIR/${TESTSUITE}.${TESTNAME}"
+ prefix="$TESTLOG_PREFIX.$TESTNAME"
suffix="$ts.log"
echo "Dumping lctl log to ${prefix}.*.${suffix}"
dmesg > ${prefix}.dmesg.\\\$(hostname -s).${suffix}"
if [ ! -f $LOGDIR/shared ]; then
do_nodes $list rsync -az "${prefix}.*.${suffix}" $HOSTNAME:$LOGDIR
- fi
-
- local archive=$LOGDIR/${TESTSUITE}-$ts.tar.bz2
- tar -jcf $archive $LOGDIR/*$ts* $LOGDIR/*${TESTSUITE}*
-
- echo $archive
-}
-
-cleanup_logs () {
- local list=${1:-$(comma_list $(nodes_list))}
-
- [ -n ${TESTSUITE} ] && do_nodes $list "rm -f $TMP/*${TESTSUITE}*" || true
+ fi
}
do_ls () {
echo -n "checking $dir..."
res=$(do_check_flavor $dir $flavor)
echo "found $res/$expect $flavor connections"
- [ $res -eq $expect ] && return 0
+ [ $res -ge $expect ] && return 0
sleep 4
done
# Not found. Create local logdir
mkdir -p $dir
else
- touch $dir/node.$(hostname -s).yml
+ touch $dir/check_file.$(hostname -s)
fi
return 0
}
check_write_access() {
local dir=$1
+ local node
+ local file
+
for node in $(nodes_list); do
- if [ ! -f "$dir/node.$(short_hostname ${node}).yml" ]; then
+ file=$dir/check_file.$(short_hostname $node)
+ if [[ ! -f "$file" ]]; then
# Logdir not accessible/writable from this node.
return 1
fi
+ rm -f $file || return 1
done
return 0
}
mkdir -p $LOGDIR
init_clients_lists
- do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $LOGDIR
- if check_write_access $LOGDIR; then
- touch $LOGDIR/shared
- echo "Logging to shared log directory: $LOGDIR"
- else
- echo "Logging to local directory: $LOGDIR"
- fi
+ if [ ! -f $YAML_LOG ]; then # If the yaml log already exists then we will just append to it
+ if check_shared_dir $LOGDIR; then
+ touch $LOGDIR/shared
+ echo "Logging to shared log directory: $LOGDIR"
+ else
+ echo "Logging to local directory: $LOGDIR"
+ fi
- yml_nodes_file $LOGDIR >> $YAML_LOG
- yml_results_file >> $YAML_LOG
+ yml_nodes_file $LOGDIR >> $YAML_LOG
+ yml_results_file >> $YAML_LOG
+ fi
umask $SAVE_UMASK
}