export TEST_FAILED=false
export FAIL_ON_SKIP_ENV=${FAIL_ON_SKIP_ENV:-false}
- export MKE2FS=${MKE2FS:-mke2fs}
- export DEBUGFS=${DEBUGFS:-debugfs}
- export TUNE2FS=${TUNE2FS:-tune2fs}
- export E2LABEL=${E2LABEL:-e2label}
- export DUMPE2FS=${DUMPE2FS:-dumpe2fs}
- export E2FSCK=${E2FSCK:-e2fsck}
- export LFSCK_BIN=${LFSCK_BIN:-lfsck}
+ export MKE2FS=$MKE2FS
+ if [ -z "$MKE2FS" ]; then
+ if which mkfs.ldiskfs >/dev/null 2>&1; then
+ export MKE2FS=mkfs.ldiskfs
+ else
+ export MKE2FS=mke2fs
+ fi
+ fi
+
+ export DEBUGFS=$DEBUGFS
+ if [ -z "$DEBUGFS" ]; then
+ if which debugfs.ldiskfs >/dev/null 2>&1; then
+ export DEBUGFS=debugfs.ldiskfs
+ else
+ export DEBUGFS=debugfs
+ fi
+ fi
+
+ export TUNE2FS=$TUNE2FS
+ if [ -z "$TUNE2FS" ]; then
+ if which tunefs.ldiskfs >/dev/null 2>&1; then
+ export TUNE2FS=tunefs.ldiskfs
+ else
+ export TUNE2FS=tune2fs
+ fi
+ fi
+
+ export E2LABEL=$E2LABEL
+ if [ -z "$E2LABEL" ]; then
+ if which label.ldiskfs >/dev/null 2>&1; then
+ export E2LABEL=label.ldiskfs
+ else
+ export E2LABEL=e2label
+ fi
+ fi
+
+ export DUMPE2FS=$DUMPE2FS
+ if [ -z "$DUMPE2FS" ]; then
+ if which dumpfs.ldiskfs >/dev/null 2>&1; then
+ export DUMPE2FS=dumpfs.ldiskfs
+ else
+ export DUMPE2FS=dumpe2fs
+ fi
+ fi
+ export E2FSCK=$E2FSCK
+ if [ -z "$E2FSCK" ]; then
+ if which fsck.ldiskfs >/dev/null 2>&1; then
+ export E2FSCK=fsck.ldiskfs
+ else
+ export E2FSCK=e2fsck
+ fi
+ fi
+
+ export LFSCK_BIN=${LFSCK_BIN:-lfsck}
export LFSCK_ALWAYS=${LFSCK_ALWAYS:-"no"} # check fs after each test suite
export FSCK_MAX_ERR=4 # File system errors left uncorrected
fi
fi
export LL_DECODE_FILTER_FID=${LL_DECODE_FILTER_FID:-"$LUSTRE/utils/ll_decode_filter_fid"}
- [ ! -f "$LL_DECODE_FILTER_FID" ] && export LL_DECODE_FILTER_FID=$(which ll_decode_filter_fid)
+ [ ! -f "$LL_DECODE_FILTER_FID" ] && export LL_DECODE_FILTER_FID="ll_decode_filter_fid"
export MKFS=${MKFS:-"$LUSTRE/utils/mkfs.lustre"}
- [ ! -f "$MKFS" ] && export MKFS=$(which mkfs.lustre)
+ [ ! -f "$MKFS" ] && export MKFS="mkfs.lustre"
export TUNEFS=${TUNEFS:-"$LUSTRE/utils/tunefs.lustre"}
- [ ! -f "$TUNEFS" ] && export TUNEFS=$(which tunefs.lustre)
+ [ ! -f "$TUNEFS" ] && export TUNEFS="tunefs.lustre"
export CHECKSTAT="${CHECKSTAT:-"checkstat -v"} "
export LUSTRE_RMMOD=${LUSTRE_RMMOD:-$LUSTRE/scripts/lustre_rmmod}
[ ! -f "$LUSTRE_RMMOD" ] &&
IDENTITY_UPCALL=false
;;
esac
+ USE_OFD=${USE_OFD:-yes}
+ [ "$USE_OFD" = "yes" ] && LOAD_MODULES_REMOTE=true
+
export LOAD_MODULES_REMOTE=${LOAD_MODULES_REMOTE:-false}
# Paths on remote nodes, if different
load_modules_local() {
[ $(facet_fstype ost1) == "zfs" ] && export USE_OFD=yes
- if [ "$USE_OFD" == yes ]; then
- if module_loaded obdfilter; then
- if ! $LUSTRE_RMMOD ldiskfs; then
- echo "$HOSTNAME may still be using obdfilter.ko"
- return 1
- fi
- fi
- else
- if module_loaded ofd; then
- if ! $LUSTRE_RMMOD ldiskfs; then
- echo "$HOSTNAME may still be using ofd.ko"
- return 1
- fi
- fi
- fi
if [ -n "$MODPROBE" ]; then
# use modprobe
fi
fi
- local ncpts=0
# if there is only one CPU core, libcfs can only create one partition
# if there is more than 4 CPU cores, libcfs should create multiple CPU
# partitions. So we just force libcfs to create 2 partitions for
if [ $ncpus -le 4 ] && [ $ncpus -gt 1 ]; then
# force to enable multiple CPU partitions
echo "Force libcfs to create 2 CPU partitions"
- ncpts=2
+ MODOPTS_LIBCFS="cpu_npartitions=2 $MODOPTS_LIBCFS"
else
echo "libcfs will create CPU partition based on online CPUs"
fi
- load_module ../libcfs/libcfs/libcfs cpu_npartitions=$ncpts
+ load_module ../libcfs/libcfs/libcfs
[ "$PTLDEBUG" ] && lctl set_param debug="$PTLDEBUG"
[ "$SUBSYSTEM" ] && lctl set_param subsystem_debug="${SUBSYSTEM# }"
load_module ost/ost
load_module lod/lod
load_module osp/osp
- if [ "$USE_OFD" == yes ]; then
- load_module ofd/ofd
- else
- load_module obdfilter/obdfilter
- fi
+ load_module ofd/ofd
load_module osp/osp
fi
# bug 19124
# load modules on remote nodes optionally
# lustre-tests have to be installed on these nodes
- if $LOAD_MODULES_REMOTE ; then
+ if $LOAD_MODULES_REMOTE; then
local list=$(comma_list $(remote_nodes_list))
- echo loading modules on $list
- do_rpc_nodes $list load_modules_local
+ if [ -n "$list" ]; then
+ echo "loading modules on: '$list'"
+ do_rpc_nodes "$list" load_modules_local
+ fi
fi
}
$LUSTRE_RMMOD ldiskfs || return 2
- if $LOAD_MODULES_REMOTE ; then
+ if $LOAD_MODULES_REMOTE; then
local list=$(comma_list $(remote_nodes_list))
- if [ ! -z $list ]; then
- echo unloading modules on $list
- do_rpc_nodes $list $LUSTRE_RMMOD ldiskfs
- do_rpc_nodes $list check_mem_leak
+ if [ -n "$list" ]; then
+ echo "unloading modules on: '$list'"
+ do_rpc_nodes "$list" $LUSTRE_RMMOD ldiskfs
+ do_rpc_nodes "$list" check_mem_leak
fi
fi
}
set_default_debug_nodes () {
- local nodes=$1
+ local nodes="$1"
- if [[ ,$nodes, = *,$HOSTNAME,* ]]; then
- nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
- set_default_debug
- fi
+ if [[ ,$nodes, = *,$HOSTNAME,* ]]; then
+ 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
+ do_rpc_nodes "$nodes" set_default_debug \
+ \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
}
set_default_debug_facet () {
}
check_progs_installed () {
- local nodes=$1
- shift
+ local nodes=$1
+ shift
- do_rpc_nodes $nodes _check_progs_installed $@
+ do_rpc_nodes "$nodes" _check_progs_installed $@
}
# recovery-scale functions
fi
echo affected facets: $facets
- # we can use "for" here because we are waiting the slowest
- for facet in ${facets//,/ }; do
- local var_svc=${facet}_svc
- local param="*.${!var_svc}.recovery_status"
+ # we can use "for" here because we are waiting the slowest
+ for facet in ${facets//,/ }; do
+ local var_svc=${facet}_svc
+ local param="*.${!var_svc}.recovery_status"
- local host=$(facet_active_host $facet)
- do_rpc_nodes $host _wait_recovery_complete $param $MAX
- done
+ local host=$(facet_active_host $facet)
+ do_rpc_nodes "$host" _wait_recovery_complete $param $MAX
+ done
}
wait_mds_ost_sync () {
# make sure there will be no seq change
local clients=${CLIENTS:-$HOSTNAME}
- do_nodes $clients "f=${MOUNT}/fsa-\\\$(hostname); mcreate \\\$f; rm \\\$f"
+ local f=fsa-\\\$\(hostname\)
+ do_nodes $clients "mcreate $MOUNT/$f; rm $MOUNT/$f"
+ do_nodes $clients "if [ -d $MOUNT2 ]; then mcreate $MOUNT2/$f; rm $MOUNT2/$f; fi"
local svc=${facet}_svc
do_facet $facet $LCTL --device %${!svc} notransno
[ $period -lt $timeout ] || log "$count OST are inactive after $timeout seconds, give up"
}
+set_conf_param_and_check() {
+ local myfacet=$1
+ local TEST=$2
+ local PARAM=$3
+ local ORIG=$(do_facet $myfacet "$TEST")
+ if [ $# -gt 3 ]; then
+ local FINAL=$4
+ else
+ local -i FINAL
+ FINAL=$((ORIG + 5))
+ fi
+ echo "Setting $PARAM from $ORIG to $FINAL"
+ do_facet mgs "$LCTL conf_param $PARAM='$FINAL'" ||
+ error "conf_param $PARAM failed"
+
+ wait_update $(facet_host $myfacet) "$TEST" "$FINAL" ||
+ error "check $PARAM failed!"
+}
+
init_param_vars () {
remote_mds_nodsh ||
TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout")
}
check_config_clients () {
- local clients=${CLIENTS:-$HOSTNAME}
- local mntpt=$1
+ local clients=${CLIENTS:-$HOSTNAME}
+ local mntpt=$1
- nfs_client_mode && return
+ nfs_client_mode && return
- do_rpc_nodes $clients check_config_client $mntpt
+ do_rpc_nodes "$clients" check_config_client $mntpt
- sanity_mount_check ||
- error "environments are insane!"
+ sanity_mount_check || error "environments are insane!"
}
check_timeout () {
# verify a directory is shared among nodes.
check_shared_dir() {
- local dir=$1
+ 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
+ [ -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.
eval $@
}
+# Convert a space-delimited list to a comma-delimited list. If the input is
+# only whitespace, ensure the output is empty (i.e. "") so [ -n $list ] works
comma_list() {
- # the sed converts spaces to commas, but leaves the last space
- # alone, so the line doesn't end with a comma.
- echo "$*" | tr -s " " "\n" | sort -b -u | tr "\n" " " | sed 's/ \([^$]\)/,\1/g'
+ # echo is used to convert newlines to spaces, since it doesn't
+ # introduce a trailing space as using "tr '\n' ' '" does
+ echo $(tr -s " " "\n" <<< $* | sort -b -u) | tr ' ' ','
}
list_member () {
}
remote_nodes_list () {
- local rnodes=$(nodes_list)
- rnodes=$(echo " $rnodes " | sed -re "s/\s+$HOSTNAME\s+/ /g")
- echo $rnodes
+ echo $(nodes_list) | sed -re "s/\<$HOSTNAME\>//g"
}
init_clients_lists () {
}
check_catastrophe() {
- local rnodes=${1:-$(comma_list $(remote_nodes_list))}
- local C=$CATASTROPHE
- [ -f $C ] && [ $(cat $C) -ne 0 ] && return 1
+ local rnodes=${1:-$(comma_list $(remote_nodes_list))}
+ local C=$CATASTROPHE
+ [ -f $C ] && [ $(cat $C) -ne 0 ] && return 1
+
+ [ -z "$rnodes" ] && return 0
- if [ $rnodes ]; then
- do_nodes $rnodes "rc=\\\$([ -f $C ] && echo \\\$(< $C) || echo 0);
-if [ \\\$rc -ne 0 ]; then echo \\\$(hostname): \\\$rc; fi
-exit \\\$rc;"
- fi
+ do_nodes "$rnodes" "rc=\\\$([ -f $C ] && echo \\\$(< $C) || echo 0);
+ if [ \\\$rc -ne 0 ]; then echo \\\$(hostname): \\\$rc; fi
+ exit \\\$rc;"
}
# CMD: determine mds index where directory inode presents
# 2. wait the deadline of client 2nd request
local maxtime=$(( 2 * $(request_timeout $facet)))
- if ! do_rpc_nodes $(facet_host $facet) \
- _wait_import_state $expected $param $maxtime; then
- error "import is not in ${expected} state"
- return 1
- fi
+ if ! do_rpc_nodes "$(facet_host $facet)" \
+ _wait_import_state $expected $param $maxtime; then
+ error "import is not in ${expected} state"
+ return 1
+ fi
- return 0
+ return 0
}
get_clientmdc_proc_path() {
}
do_rpc_nodes () {
- local list=$1
- shift
+ local list=$1
+ shift
+
+ [ -z "$list" ] && return 0
- # Add paths to lustre tests for 32 and 64 bit systems.
- local RPATH="PATH=$RLUSTRE/tests:/usr/lib/lustre/tests:/usr/lib64/lustre/tests:$PATH"
- do_nodesv $list "${RPATH} NAME=${NAME} sh rpc.sh $@ "
+ # Add paths to lustre tests for 32 and 64 bit systems.
+ local RPATH="PATH=$RLUSTRE/tests:/usr/lib/lustre/tests:/usr/lib64/lustre/tests:$PATH"
+ do_nodesv $list "${RPATH} NAME=${NAME} sh rpc.sh $@ "
}
wait_clients_import_state () {
local params=$(expand_list $params $proc_path)
done
- if ! do_rpc_nodes $list wait_import_state $expected $params; then
- error "import is not in ${expected} state"
- return 1
- fi
+ if ! do_rpc_nodes "$list" wait_import_state $expected $params; then
+ error "import is not in ${expected} state"
+ return 1
+ fi
}
oos_full() {
${rcmd} umount -d $mntpt || return 2
# OI files will be recreated when mounted as lustre next time.
}
+
+# generate maloo upload-able log file name
+# \param logname specify unique part of file name
+generate_logname() {
+ local logname=${1:-"default_logname"}
+
+ echo "$TESTLOG_PREFIX.$TESTNAME.$logname.$(hostname -s).log"
+}