export LTESTDIR=${LTESTDIR:-$LUSTRE/../ltest}
[ -d /r ] && export ROOT=/r
+ export TMP=${TMP:-$ROOT/tmp}
export PATH=:$PATH:$LUSTRE/utils:$LUSTRE/tests
+ export LLMOUNT=${LLMOUNT:-"llmount"}
export LCONF=${LCONF:-"lconf"}
export LMC=${LMC:-"lmc"}
- export LCTL=${LCTL:-"lctl"}
+ export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
export CHECKSTAT="${CHECKSTAT:-checkstat} "
# Paths on remote nodes, if different
# save the name of the config file for the upcall
echo "XMLCONFIG=$LUSTRE/tests/$XMLCONFIG" > $LUSTRE/tests/XMLCONFIG
+# echo "CONFIG=`canonical_path $CONFIG`" > $LUSTRE/tests/CONFIG
}
# Facet functions
}
zconf_mount() {
- mnt=$1
+ client=$1
+ mnt=$2
+
+ do_node $client mkdir $mnt 2> /dev/null || :
- [ -d $mnt ] || mkdir $mnt
-
if [ -x /sbin/mount.lustre ] ; then
- mount -t lustre -o nettype=$NETTYPE \
- `facet_host mds`:/mds_svc/client_facet $mnt
+ do_node $client mount -t lustre -o nettype=$NETTYPE `facet_active_host mds`:/mds_svc/client_facet $mnt || return 1
else
# this is so cheating
+ do_node $client $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null || return 2
$LCONF --nosetup --node client_facet $XMLCONFIG
- $LUSTRE/utils/llmount `facet_host mds`:/mds_svc/client_facet $mnt \
- -o nettype=$NETTYPE
+ do_node $client $LLMOUNT `facet_active_host mds`:/mds_svc/client_facet $mnt -o nettype=$NETTYPE|| return 4
fi
[ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
}
zconf_umount() {
- mnt=$1
- umount $mnt || :
- $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG || :
+ client=$1
+ mnt=$2
+ [ "$3" ] && force=-f
+ do_node $client umount $force $mnt || :
+ do_node $client $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null || :
}
shutdown_facet() {
wait_for_host() {
HOST=$1
check_network $HOST 900
- while ! do_node $HOST "$CHECKSTAT -t dir $LUSTRE"; do sleep 5; done
+ while ! do_node $HOST "ls -d $LUSTRE " > /dev/null; do sleep 5; done
}
wait_for() {
reboot_facet $facet
client_df &
DFPID=$!
+ echo "df pid is $DFPID"
change_active $facet
TO=`facet_active_host $facet`
- echo "Failover MDS to $TO"
+ echo "Failover $facet to $TO"
wait_for $facet
start $facet
}
$LMC -m ${XMLCONFIG} $@
}
+h2gm () {
+ if [ "$1" = "client" ]; then echo \'*\'; else
+ $PDSH $1 $GMNALNID -l | cut -d\ -f2
+ fi
+}
+
h2tcp() {
if [ "$1" = "client" ]; then echo \'*\'; else
echo $1
facet_active_host() {
local facet=$1
local active=`facet_active $facet`
- echo `facet_host $active`
+ if [ "$facet" == client ]; then
+ hostname
+ else
+ echo `facet_host $active`
+ fi
}
change_active() {
if $VERBOSE; then
echo "CMD: $HOST $@"
- $PDSH $HOST $LCTL mark "$@" || :
+ $PDSH $HOST $LCTL mark "$@" > /dev/null 2>&1 || :
fi
$PDSH $HOST "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests; cd $RPWD; sh -c \"$@\")"
}
local facet=$1
shift
echo "add facet $facet: `facet_host $facet`"
- do_lmc --add node --node ${facet}_facet $@ --timeout $TIMEOUT
+ do_lmc --add node --node ${facet}_facet $@ --timeout $TIMEOUT \
+ --lustre_upcall $UPCALL --ptldebug $PTLDEBUG --subsystem $SUBSYSTEM
do_lmc --add net --node ${facet}_facet --nid `facet_nid $facet` \
--nettype $NETTYPE
}
facet=$1
shift
rm -f ${facet}active
- add_facet $facet --lustre_upcall $UPCALL --ptldebug $PTLDEBUG \
- --subsystem $SUBSYSTEM
+ add_facet $facet
do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc $*
}
return $RC
}
+clear_failloc() {
+ facet=$1
+ pause=$2
+ sleep $pause
+ echo "clearing fail_loc on $facet"
+ do_facet $facet "sysctl -w lustre.fail_loc=0"
+}
+
cancel_lru_locks() {
$LCTL mark cancel_lru_locks
for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
done
}
+
+pgcache_empty() {
+ for a in /proc/fs/lustre/llite/*/dump_page_cache; do
+ if [ `wc -l $a | awk '{print $1}'` -gt 1 ]; then
+ echo there is still data in page cache $a ?
+ cat $a;
+ return 1;
+ fi
+ done
+ return 0
+}
+
##################################
# Test interface
error() {
echo "${TESTSUITE}: **** FAIL:" $@
+ log "FAIL: $@"
exit 1
}
printf '===== %s %.*s\n' "$msg" $suffixlen $EQUALS
}
+log() {
+ echo "$*"
+ lctl mark "$*" 2> /dev/null || true
+}
+
run_one() {
testnum=$1
message=$2
- tfile=f$base
- tdir=d$base
+ tfile=f${testnum}
+ tdir=d${base}
# Pretty tests run faster.
equals_msg $testnum: $message
+ log "== test $1: $2"
test_${testnum} || error "test_$testnum failed with $?"
}
+
+canonical_path() {
+ (cd `dirname $1`; echo $PWD/`basename $1`)
+}
+