#!/bin/bash
# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
-trap 'echo "test-framework exiting on error"' ERR
+trap 'print_summary && echo "test-framework exiting on error"' ERR
set -e
#set -x
export GSS=false
export GSS_KRB5=false
export GSS_PIPEFS=false
+export IDENTITY_UPCALL=false
#export PDSH="pdsh -S -Rssh -w"
# eg, assert_env LUSTRE MDSNODES OSTNODES CLIENTS
exit
}
+print_summary () {
+ [ "$TESTSUITE" == "lfscktest" ] && return 0
+ [ -n "$ONLY" ] && echo "WARNING: ONLY is set to ${ONLY}."
+ local form="%-13s %-17s %s\n"
+ printf "$form" "status" "script" "skipped tests E(xcluded) S(low)"
+ echo "------------------------------------------------------------------------------------"
+ for O in $TESTSUITE_LIST; do
+ local skipped=""
+ local slow=""
+ local o=$(echo $O | tr "[:upper:]" "[:lower:]")
+ o=${o//_/-}
+ o=${o//tyn/tyN}
+ local log=${TMP}/${o}.log
+ [ -f $log ] && skipped=$(grep excluded $log | awk '{ printf " %s", $3 }' | sed 's/test_//g')
+ [ -f $log ] && slow=$(grep SLOW $log | awk '{ printf " %s", $3 }' | sed 's/test_//g')
+ [ "${!O}" = "done" ] && \
+ printf "$form" "Done" "$O" "E=$skipped" && \
+ [ -n "$slow" ] && printf "$form" "-" "-" "S=$slow"
+
+ done
+
+ for O in $TESTSUITE_LIST; do
+ [ "${!O}" = "no" ] && \
+ printf "$form" "Skipped" "$O" ""
+ done
+
+ for O in $TESTSUITE_LIST; do
+ [ "${!O}" = "done" -o "${!O}" = "no" ] || \
+ printf "$form" "UNFINISHED" "$O" ""
+ done
+}
+
init_test_env() {
export LUSTRE=`absolute_path $LUSTRE`
export TESTSUITE=`basename $0 .sh`
[ -d /r ] && export ROOT=${ROOT:-/r}
export TMP=${TMP:-$ROOT/tmp}
export TESTSUITELOG=${TMP}/${TESTSUITE}.log
+ export HOSTNAME=${HOSTNAME:-`hostname`}
export PATH=:$PATH:$LUSTRE/utils:$LUSTRE/utils/gss:$LUSTRE/tests
export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
+ [ ! -f "$LCTL" ] && export LCTL=$(which lctl)
export LFS=${LFS:-"$LUSTRE/utils/lfs"}
- [ ! -f "$LCTL" ] && export LCTL=$(which lctl)
- export LFS=${LFS:-"$LUSTRE/utils/lfs"}
- [ ! -f "$LFS" ] && export LFS=$(which lfs)
+ [ ! -f "$LFS" ] && export LFS=$(which lfs)
+ export L_GETIDENTITY=${L_GETIDENTITY:-"$LUSTRE/utils/l_getidentity"}
+ if [ ! -f "$L_GETIDENTITY" ]; then
+ if `which l_getidentity > /dev/null 2>&1`; then
+ export L_GETIDENTITY=$(which l_getidentity)
+ else
+ export L_GETIDENTITY=NONE
+ fi
+ fi
export MKFS=${MKFS:-"$LUSTRE/utils/mkfs.lustre"}
- [ ! -f "$MKFS" ] && export MKFS=$(which mkfs.lustre)
+ [ ! -f "$MKFS" ] && export MKFS=$(which mkfs.lustre)
export TUNEFS=${TUNEFS:-"$LUSTRE/utils/tunefs.lustre"}
- [ ! -f "$TUNEFS" ] && export TUNEFS=$(which tunefs.lustre)
+ [ ! -f "$TUNEFS" ] && export TUNEFS=$(which tunefs.lustre)
export CHECKSTAT="${CHECKSTAT:-"checkstat -v"} "
export FSYTPE=${FSTYPE:-"ldiskfs"}
export NAME=${NAME:-local}
export LPROC=/proc/fs/lustre
export LGSSD=${LGSSD:-"$LUSTRE/utils/gss/lgssd"}
+ [ "$GSS_PIPEFS" = "true" ] && [ ! -f "$LGSSD" ] && \
+ export LGSSD=$(which lgssd)
export LSVCGSSD=${LSVCGSSD:-"$LUSTRE/utils/gss/lsvcgssd"}
+ [ ! -f "$LSVCGSSD" ] && export LSVCGSSD=$(which lsvcgssd)
export KRB5DIR=${KRB5DIR:-"/usr/kerberos"}
export DIR2
;;
esac
- # Paths on remote nodes, if different
+ case "x$ID" in
+ xtrue)
+ IDENTITY_UPCALL=true
+ ;;
+ xfalse)
+ IDENTITY_UPCALL=false
+ ;;
+ esac
+
+ # Paths on remote nodes, if different
export RLUSTRE=${RLUSTRE:-$LUSTRE}
export RPWD=${RPWD:-$PWD}
export I_MOUNTED=${I_MOUNTED:-"no"}
# command line
-
- while getopts "rvf:" opt $*; do
+
+ while getopts "rvf:" opt $*; do
case $opt in
f) CONFIG=$OPTARG;;
r) REFORMAT=--reformat;;
echo Loading modules from $LUSTRE
load_module ../lnet/libcfs/libcfs
- [ -z "$LNETOPTS" ] && \
- LNETOPTS=$(awk '/^options lnet/ { print $0}' /etc/modprobe.conf | sed 's/^options lnet //g')
+ [ -f /etc/modprobe.conf ] && MODPROBECONF=/etc/modprobe.conf
+ [ -f /etc/modprobe.d/Lustre ] && MODPROBECONF=/etc/modprobe.d/Lustre
+ [ -z "$LNETOPTS" -a -n "$MODPROBECONF" ] && \
+ LNETOPTS=$(awk '/^options lnet/ { print $0}' $MODPROBECONF | sed 's/^options lnet //g')
echo "lnet options: '$LNETOPTS'"
# note that insmod will ignore anything in modprobe.conf
load_module ../lnet/lnet/lnet $LNETOPTS
LNETLND=${LNETLND:-"socklnd/ksocklnd"}
load_module ../lnet/klnds/$LNETLND
- [ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
load_module lvfs/lvfs
load_module obdclass/obdclass
- load_module lvfs/fsfilt_$FSTYPE
load_module ptlrpc/ptlrpc
load_module ptlrpc/gss/ptlrpc_gss
# Now, some modules depend on lquota without USE_QUOTA check,
load_module mdc/mdc
load_module osc/osc
load_module lov/lov
- load_module mds/mds
- load_module mdd/mdd
- load_module mdt/mdt
- load_module cmm/cmm
- load_module osd/osd
- load_module ost/ost
- load_module obdfilter/obdfilter
+ load_module mgc/mgc
+ if [ -z "$CLIENTONLY" ]; then
+ [ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
+ load_module mgs/mgs
+ load_module mds/mds
+ load_module mdd/mdd
+ load_module mdt/mdt
+ load_module lvfs/fsfilt_$FSTYPE
+ load_module cmm/cmm
+ load_module osd/osd
+ load_module ost/ost
+ load_module obdfilter/obdfilter
+ fi
+
load_module llite/lustre
load_module llite/llite_lloop
- load_module mgc/mgc
- load_module mgs/mgs
- rm -f $TMP/ogdb-`hostname`
- $LCTL modules > $TMP/ogdb-`hostname`
+ rm -f $TMP/ogdb-$HOSTNAME
+ OGDB=$TMP
+ [ -d /r ] && OGDB="/r/tmp"
+ $LCTL modules > $OGDB/ogdb-$HOSTNAME
+
# 'mount' doesn't look in $PATH, just sbin
[ -f $LUSTRE/utils/mount.lustre ] && cp $LUSTRE/utils/mount.lustre /sbin/. || true
}
}
unload_modules() {
+ wait_exit_ST client # bug 12845
+
lsmod | grep lnet > /dev/null && $LCTL dl && $LCTL dk $TMP/debug
local MODULES=$($LCTL modules | awk '{ print $2 }')
$RMMOD $MODULES > /dev/null 2>&1 || true
MODULES=$($LCTL modules | awk '{ print $2 }')
if [ -n "$MODULES" ]; then
echo "Modules still loaded: "
- echo $MODULES
+ echo $MODULES
if [ -e $LPROC ]; then
echo "Lustre still loaded"
cat $LPROC/devices || true
send_sigint client lgssd
}
-init_krb5_env() {
- if [ ! -z $SEC ]; then
- MDS_MOUNT_OPTS=$MDS_MOUNT_OPTS,sec=$SEC
- OST_MOUNT_OPTS=$OST_MOUNT_OPTS,sec=$SEC
- fi
-
+init_gss() {
if $GSS; then
start_gss_daemons
fi
}
-cleanup_krb5_env() {
+cleanup_gss() {
if $GSS; then
stop_gss_daemons
# maybe cleanup credential cache?
}
# Facet functions
-# start facet device options
+# start facet device options
start() {
facet=$1
shift
shift
echo "Starting ${facet}: $@ ${device} ${MOUNT%/*}/${facet}"
do_facet ${facet} mkdir -p ${MOUNT%/*}/${facet}
- do_facet ${facet} mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
+ do_facet ${facet} mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
RC=${PIPESTATUS[0]}
if [ $RC -ne 0 ]; then
- echo mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
+ echo mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
echo Start of ${device} on ${facet} failed ${RC}
- else
+ else
+ do_facet ${facet} "sysctl -w lnet.debug=$PTLDEBUG; \
+ sysctl -w lnet.subsystem_debug=${SUBSYSTEM# }; \
+ sysctl -w lnet.debug_mb=${DEBUG_SIZE}"
+
do_facet ${facet} sync
label=$(do_facet ${facet} "e2label ${device}")
[ -z "$label" ] && echo no label for ${device} && exit 1
# umount should block, but we should wait for unrelated obd's
# like the MGS or MGC to also stop.
- local WAIT=0
- local INTERVAL=1
- # conf-sanity 31 takes a long time cleanup
- while [ $WAIT -lt 300 ]; do
- running=$(do_facet ${facet} "[ -e $LPROC ] && grep ST' ' $LPROC/devices") || true
- if [ -z "${running}" ]; then
- return 0
- fi
- echo "waited $WAIT for${running}"
- if [ $INTERVAL -lt 64 ]; then
- INTERVAL=$((INTERVAL + INTERVAL))
- fi
- sleep $INTERVAL
- WAIT=$((WAIT + INTERVAL))
- done
- echo "service didn't stop after $WAIT seconds. Still running:"
- echo ${running}
- exit 1
+ wait_exit_ST ${facet}
}
zconf_mount() {
exit 1
fi
- echo "Starting client: $OPTIONS $device $mnt"
+ echo "Starting client: $OPTIONS $device $mnt"
do_node $client mkdir -p $mnt
do_node $client mount -t lustre $OPTIONS $device $mnt || return 1
- do_node $client "sysctl -w lnet.debug=$PTLDEBUG; sysctl -w lnet.subsystem_debug=${SUBSYSTEM# }"
- [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
+ do_node $client "sysctl -w lnet.debug=$PTLDEBUG;
+ sysctl -w lnet.subsystem_debug=${SUBSYSTEM# };
+ sysctl -w lnet.debug_mb=${DEBUG_SIZE}"
+ [ -d /r ] && $LCTL modules > /r/tmp/ogdb-$HOSTNAME
return 0
}
local running=$(do_node $client "grep -c $mnt' ' /proc/mounts") || true
if [ $running -ne 0 ]; then
echo "Stopping client $mnt (opts:$force)"
+ lsof | grep "$mnt" || true
do_node $client umount $force $mnt
fi
}
facet=$1
if [ "$FAILURE_MODE" = HARD ]; then
$POWER_DOWN `facet_active_host $facet`
- sleep 2
+ sleep 2
elif [ "$FAILURE_MODE" = SOFT ]; then
stop $facet
fi
return 0
}
+wait_delete_completed () {
+ local TOTALPREV=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
+ $LPROC/osc/*/kbytesavail`
+
+ local WAIT=0
+ local MAX_WAIT=20
+ while [ "$WAIT" -ne "$MAX_WAIT" ]; do
+ sleep 1
+ TOTAL=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
+ $LPROC/osc/*/kbytesavail`
+ [ "$TOTAL" -eq "$TOTALPREV" ] && break
+ echo "Waiting delete completed ... prev: $TOTALPREV current: $TOTAL "
+ TOTALPREV=$TOTAL
+ WAIT=$(( WAIT + 1))
+ done
+ echo "Delete completed."
+}
+
wait_for_host() {
HOST=$1
check_network "$HOST" 900
echo "Waiting $(($MAX - $WAIT)) secs for MDS recovery done"
done
echo "MDS recovery not done in $MAX sec"
- return 1
+ return 1
+}
+
+wait_exit_ST () {
+ local facet=$1
+
+ local WAIT=0
+ local INTERVAL=1
+ # conf-sanity 31 takes a long time cleanup
+ while [ $WAIT -lt 300 ]; do
+ running=$(do_facet ${facet} "[ -e $LPROC ] && grep ST' ' $LPROC/devices") || true
+ [ -z "${running}" ] && return 0
+ echo "waited $WAIT for${running}"
+ [ $INTERVAL -lt 64 ] && INTERVAL=$((INTERVAL + INTERVAL))
+ sleep $INTERVAL
+ WAIT=$((WAIT + INTERVAL))
+ done
+ echo "service didn't stop after $WAIT seconds. Still running:"
+ echo ${running}
+ return 1
}
client_df() {
df $MOUNT || error "post-failover df: $?"
}
+fail_nodf() {
+ local facet=$1
+ facet_failover $facet
+}
+
fail_abort() {
local facet=$1
stop $facet
h2name_or_ip() {
if [ "$1" = "client" -o "$1" = "'*'" ]; then echo \'*\'; else
- echo $1"@$2"
+ echo $1"@$2"
fi
}
fi
active=${!activevar}
- if [ -z "$active" ] ; then
+ if [ -z "$active" ] ; then
echo -n ${facet}
else
echo -n ${active}
local facet=$1
local active=`facet_active $facet`
if [ "$facet" == client ]; then
- hostname
+ echo $HOSTNAME
else
echo `facet_host $active`
fi
change_active() {
local facet=$1
- failover=${facet}failover
+ failover=${facet}failover
host=`facet_host $failover`
[ -z "$host" ] && return
curactive=`facet_active $facet`
HOST=$1
shift
local myPDSH=$PDSH
- if [ "$HOST" = "$(hostname)" ]; then
+ if [ "$HOST" = "$HOSTNAME" ]; then
myPDSH="no_dsh"
+ elif [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" ]; then
+ echo "cannot run remote command on $HOST with $myPDSH"
+ return 128
fi
if $VERBOSE; then
echo "CMD: $HOST $@" >&2
if [ $activemds != "mds1" ]; then
fail mds1
fi
-
- # assume client mount is local
- grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT $*
- grep " $MOUNT2 " /proc/mounts && zconf_umount `hostname` $MOUNT2 $*
+
+ # assume client mount is local
+ grep " $MOUNT " /proc/mounts && zconf_umount $HOSTNAME $MOUNT $*
+ grep " $MOUNT2 " /proc/mounts && zconf_umount $HOSTNAME $MOUNT2 $*
+ [ "$CLIENTONLY" ] && return
for num in `seq $MDSCOUNT`; do
stop mds$num -f
done
cleanupall() {
stopall $*
unload_modules
- cleanup_krb5_env
+ cleanup_gss
}
mdsmkfsopts()
formatall() {
[ "$FSTYPE" ] && FSTYPE_OPT="--backfstype $FSTYPE"
+ if [ ! -z $SEC ]; then
+ MDS_MKFS_OPTS="$MDS_MKFS_OPTS --param srpc.flavor.default=$SEC"
+ OST_MKFS_OPTS="$OST_MKFS_OPTS --param srpc.flavor.default=$SEC"
+ fi
+
stopall
# We need ldiskfs here, may as well load them all
load_modules
}
mount_client() {
- grep " $1 " /proc/mounts || zconf_mount `hostname` $*
+ grep " $1 " /proc/mounts || zconf_mount $HOSTNAME $*
+}
+
+# return value:
+# 0: success, the old identity set already.
+# 1: success, the old identity does not set.
+# 2: fail.
+switch_identity() {
+ local num=$1
+ local switch=$2
+ local j=`expr $num - 1`
+ local MDT="`do_facet mds$num ls -l $LPROC/mdt/ 2>/dev/null | grep MDT | awk '{print $9}' | grep $j$`"
+
+ if [ -z "$MDT" ]; then
+ return 2
+ fi
+
+ local old="`do_facet mds$num cat $LPROC/mdt/$MDT/identity_upcall`"
+
+ if [ $switch ]; then
+ do_facet mds$num "echo \"$L_GETIDENTITY\" > $LPROC/mdt/$MDT/identity_upcall"
+ else
+ do_facet mds$num "echo \"NONE\" > $LPROC/mdt/$MDT/identity_upcall"
+ fi
+
+ do_facet mds$num "echo \"-1\" > $LPROC/mdt/$MDT/identity_flush"
+
+ if [ $old = "NONE" ]; then
+ return 1
+ else
+ return 0
+ fi
}
setupall() {
load_modules
- init_krb5_env
+ init_gss
if [ -z "$CLIENTONLY" ]; then
echo "Setup mdts, osts"
for num in `seq $MDSCOUNT`; do
echo $REFORMAT | grep -q "reformat" \
|| do_facet mds$num "$TUNEFS --writeconf $DEVNAME"
start mds$num $DEVNAME $MDS_MOUNT_OPTS
+ switch_identity $num $IDENTITY_UPCALL
done
for num in `seq $OSTCOUNT`; do
DEVNAME=$(ostdevname $num)
if [ "$ONLY" == "cleanup" -o "`mount | grep $MOUNT`" ]; then
sysctl -w lnet.debug=0 || true
cleanupall
- if [ "$ONLY" == "cleanup" ]; then
+ if [ "$ONLY" == "cleanup" ]; then
exit 0
fi
fi
check_and_cleanup_lustre() {
if [ "`mount | grep $MOUNT`" ]; then
- rm -rf $DIR/[Rdfs][1-9]*
+ [ -n "$DIR" ] && rm -rf $DIR/[Rdfs][0-9]*
fi
if [ "$I_MOUNTED" = "yes" ]; then
cleanupall -f || error "cleanup failed"
unset I_MOUNTED
}
-#######
+#######
# General functions
check_network() {
$LCTL mark "cancel_lru_locks $1 stop"
}
+default_lru_size()
+{
+ NR_CPU=$(grep -c "processor" /proc/cpuinfo)
+ DEFAULT_LRU_SIZE=$((100 * NR_CPU))
+ echo "$DEFAULT_LRU_SIZE"
+}
+
+lru_resize_enable()
+{
+ NS=$1
+ test "x$NS" = "x" && NS="mdc"
+ for F in $LPROC/ldlm/namespaces/*$NS*/lru_size; do
+ D=$(dirname $F)
+ log "Enable lru resize for $(basename $D)"
+ echo "0" > $F
+ done
+}
+
+lru_resize_disable()
+{
+ NS=$1
+ test "x$NS" = "x" && NS="mdc"
+ for F in $LPROC/ldlm/namespaces/*$NS*/lru_size; do
+ D=$(dirname $F)
+ log "Disable lru resize for $(basename $D)"
+ DEFAULT_LRU_SIZE=$(default_lru_size)
+ echo "$DEFAULT_LRU_SIZE" > $F
+ done
+}
pgcache_empty() {
for a in /proc/fs/lustre/llite/*/dump_page_cache; do
DEBUGSAVE=""
}
-FAIL_ON_ERROR=true
##################################
-# Test interface
+# Test interface
+##################################
+
error() {
+ local FAIL_ON_ERROR=${FAIL_ON_ERROR:-true}
+ local TYPE=${TYPE:-"FAIL"}
local ERRLOG
sysctl -w lustre.fail_loc=0 2> /dev/null || true
- log "${TESTSUITE} ${TESTNAME}: **** FAIL:" $@
+ log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
ERRLOG=$TMP/lustre_${TESTSUITE}_${TESTNAME}.$(date +%s)
echo "Dumping lctl log to $ERRLOG"
# We need to dump the logs on all nodes
- $LCTL dk $ERRLOG
- [ ! "$mds_HOST" = "$(hostname)" ] && do_node $mds_HOST $LCTL dk $ERRLOG
- [ ! "$ost_HOST" = "$(hostname)" -a ! "$ost_HOST" = "$mds_HOST" ] && do_node $ost_HOST $LCTL dk $ERRLOG
+ local NODES=$(nodes_list)
+ for NODE in $NODES; do
+ do_node $NODE $LCTL dk $ERRLOG
+ done
debugrestore
- [ "$TESTSUITELOG" ] && echo "$0: FAIL: $TESTNAME $@" >> $TESTSUITELOG
+ [ "$TESTSUITELOG" ] && echo "$0: ${TYPE}: $TESTNAME $@" >> $TESTSUITELOG
if $FAIL_ON_ERROR; then
exit 1
fi
}
+# use only if we are ignoring failures for this test, bugno required.
+# (like ALWAYS_EXCEPT, but run the test and ignore the results.)
+# e.g. error_ignore 5494 "your message"
+error_ignore() {
+ FAIL_ON_ERROR=false TYPE="IGNORE (bz$1)" error $2
+}
+
skip () {
log " SKIP: ${TESTSUITE} ${TESTNAME} $@"
[ "$TESTSUITELOG" ] && echo "${TESTSUITE}: SKIP: $TESTNAME $@" >> $TESTSUITELOG
done
[ "$EXCEPT$ALWAYS_EXCEPT" ] && \
log "skipping tests: `echo $EXCEPT $ALWAYS_EXCEPT`"
+ [ "$EXCEPT_SLOW" ] && \
+ log "skipping tests SLOW=no: `echo $EXCEPT_SLOW`"
for E in $EXCEPT $ALWAYS_EXCEPT; do
eval EXCEPT_${E}=true
done
+ for E in $EXCEPT_SLOW; do
+ eval EXCEPT_SLOW_${E}=true
+ done
for G in $GRANT_CHECK_LIST; do
eval GCHECK_ONLY_${G}=true
done
TESTNAME=test_$1 skip "skipping excluded test $1 (base $base)"
return 0
fi
+ testname=EXCEPT_SLOW_$1
+ if [ ${!testname}x != x ]; then
+ TESTNAME=test_$1 skip "skipping SLOW test $1"
+ return 0
+ fi
+ testname=EXCEPT_SLOW_$base
+ if [ ${!testname}x != x ]; then
+ TESTNAME=test_$1 skip "skipping SLOW test $1 (base $base)"
+ return 0
+ fi
+
run_one $1 "$2"
-
+
return $?
}
local suffixlen=$((${#EQUALS} - ${#msg}))
[ $suffixlen -lt 5 ] && suffixlen=5
- printf '===== %s %.*s\n' "$msg" $suffixlen $EQUALS
+ log `echo $(printf '===== %s %.*s\n' "$msg" $suffixlen $EQUALS)`
}
log() {
echo "$*"
lsmod | grep lnet > /dev/null || load_modules
- $LCTL mark "$*" 2> /dev/null || true
+
+ local MSG="$*"
+ # Get rif of '
+ MSG=${MSG//\'/\\\'}
+ MSG=${MSG//\(/\\\(}
+ MSG=${MSG//\)/\\\)}
+ MSG=${MSG//\;/\\\;}
+ MSG=${MSG//\|/\\\|}
+ MSG=${MSG//\>/\\\>}
+ MSG=${MSG//\</\\\<}
+ local NODES=$(nodes_list)
+ for NODE in $NODES; do
+ do_node $NODE $LCTL mark "$MSG" 2> /dev/null || true
+ done
}
trace() {
[ $FFREE -ge $FTOTAL ] && error "files free $FFREE > total $FTOTAL" || true
}
+reset_fail_loc () {
+ local myNODES=$(nodes_list)
+ local NODE
+
+ for NODE in $myNODES; do
+ do_node $NODE sysctl -w lustre.fail_loc=0 || true
+ done
+}
+
run_one() {
testnum=$1
message=$2
tfile=f${testnum}
- export tdir=d${base}
+ export tdir=d0.${TESTSUITE}/d${base}
+ local SAVE_UMASK=`umask`
+ umask 0022
+ mkdir -p $DIR/$tdir
BEFORE=`date +%s`
log "== test $testnum: $message ============ `date +%H:%M:%S` ($BEFORE)"
export TESTNAME=test_$testnum
test_${testnum} || error "test_$testnum failed with $?"
#check_mds
+ reset_fail_loc
check_grant ${testnum} || error "check_grant $testnum failed with $?"
[ -f $CATASTROPHE ] && [ `cat $CATASTROPHE` -ne 0 ] && \
error "LBUG/LASSERT detected"
pass "($((`date +%s` - $BEFORE))s)"
+ rmdir ${DIR}/$tdir >/dev/null 2>&1 || true
unset TESTNAME
unset tdir
+ umask $SAVE_UMASK
cd $SAVE_PWD
$CLEANUP
}
}
sync_clients() {
- [ -d $DIR1 ] && cd $DIR1 && sync; sleep 1; sync
- [ -d $DIR2 ] && cd $DIR2 && sync; sleep 1; sync
+ [ -d $DIR1 ] && cd $DIR1 && sync; sleep 1; sync
+ [ -d $DIR2 ] && cd $DIR2 && sync; sleep 1; sync
cd $SAVE_PWD
}
# write some data to sync client lost_grant
rm -f $DIR1/${tfile}_check_grant_* 2>&1
for i in `seq $OSTCOUNT`; do
- $LFS setstripe $DIR1/${tfile}_check_grant_$i 0 $(($i -1)) 1
+ $LFS setstripe $DIR1/${tfile}_check_grant_$i -i $(($i -1)) -c 1
dd if=/dev/zero of=$DIR1/${tfile}_check_grant_$i bs=4k \
- count=1 > /dev/null 2>&1
+ count=1 > /dev/null 2>&1
done
# sync all the data and make sure no pending data on server
sync_clients
- #get client grant and server grant
+ #get client grant and server grant
client_grant=0
- for d in ${LPROC}/osc/*/cur_grant_bytes; do
+ for d in ${LPROC}/osc/*/cur_grant_bytes; do
client_grant=$((client_grant + `cat $d`))
done
server_grant=0
rm $DIR1/${tfile}_check_grant_$i
done
- #check whether client grant == server grant
+ #check whether client grant == server grant
if [ $client_grant != $server_grant ]; then
echo "failed: client:${client_grant} server: ${server_grant}"
return 1
[ ! -e /proc/fs/lustre/mdt/*MDT* ]
}
+remote_mds_nodsh()
+{
+ remote_mds && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$mds_HOST" ]
+}
+
remote_ost ()
{
[ $(grep -c obdfilter $LPROC/devices) -eq 0 ]
}
+remote_ost_nodsh()
+{
+ remote_ost && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ]
+}
+
+mdts_nodes () {
+ local MDSNODES=$(facet_host $SINGLEMDS)
+ local NODES_sort
+
+ # FIXME: Currenly we use only $SINGLEMDS,
+ # should be fixed when we will start to test cmd.
+ echo $MDSNODES
+ return
+
+ for num in `seq $MDSCOUNT`; do
+ local myMDS=$(facet_host mds$num)
+ MDSNODES="$MDSNODES $myMDS"
+ done
+ NODES_sort=$(for i in $MDSNODES; do echo $i; done | sort -u)
+
+ echo $NODES_sort
+}
+
+osts_nodes () {
+ local OSTNODES=$(facet_host ost1)
+ local NODES_sort
+
+ for num in `seq $OSTCOUNT`; do
+ local myOST=$(facet_host ost$num)
+ OSTNODES="$OSTNODES $myOST"
+ done
+ NODES_sort=$(for i in $OSTNODES; do echo $i; done | sort -u)
+
+ echo $NODES_sort
+}
+
+nodes_list () {
+ # FIXME. We need a list of clients
+ local myNODES=$HOSTNAME
+ local myNODES_sort
+
+ if [ "$PDSH" -a "$PDSH" != "no_dsh" ]; then
+ myNODES="$myNODES $(osts_nodes) $(mdts_nodes)"
+ fi
+
+ myNODES_sort=$(for i in $myNODES; do echo $i; done | sort -u)
+
+ echo $myNODES_sort
+}
+
is_patchless ()
{
grep -q patchless $LPROC/version
}
+
+check_runas_id() {
+ local myRUNAS_ID=$1
+ shift
+ local myRUNAS=$@
+ mkdir $DIR/d0_runas_test
+ chmod 0755 $DIR
+ chown $myRUNAS_ID:$myRUNAS_ID $DIR/d0_runas_test
+ $myRUNAS touch $DIR/d0_runas_test/f$$ || \
+ error "unable to write to $DIR/d0_runas_test as UID $myRUNAS_ID.
+ Please set RUNAS_ID to some UID which exists on MDS and client or
+ add user $myRUNAS_ID:$myRUNAS_ID on these nodes."
+ rm -rf $DIR/d0_runas_test
+}