set -ex
LUSTRE=${LUSTRE:-`dirname $0`/..}
+LTESTDIR=${LTESTDIR:-"$LUSTRE/../ltest"}
PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests
-. $LUSTRE/../ltest/functional/llite/common/common.sh
+. $LTESTDIR/functional/llite/common/common.sh
+
+# Allow us to override the setup if we already have a mounted system by
+# setting SETUP=" " and CLEANUP=" "
+SETUP=${SETUP:-"setup"}
+CLEANUP=${CLEANUP:-"cleanup"}
PDSH='pdsh -S -w'
# XXX I wish all this stuff was in some default-config.sh somewhere
MDSNODE=${MDSNODE:-mdev6}
OSTNODE=${OSTNODE:-mdev7}
-CLIENT=${CLIENTNODE:-mdev8}
+CLIENT=${CLIENT:-mdev8}
NETWORKTYPE=${NETWORKTYPE:-tcp}
MOUNTPT=${MOUNTPT:-/mnt/lustre}
-CONFIG=recovery-small.xml
-MDSDEV=/tmp/mds
-OSTDEV=/tmp/ost
-MDSSIZE=100000
-OSTSIZE=100000
+CONFIG=${CONFIG:-recovery-cleanup.xml}
+MDSDEV=${MDSDEV:-/tmp/mds1-`hostname`}
+MDSSIZE=${MDSSIZE:-100000}
+FSTYPE=${FSTYPE:-ext3}
+OSTDEV=${OSTDEV:-/tmp/ost1-`hostname`}
+OSTSIZE=${OSTSIZE:-100000}
do_mds() {
- $PDSH $MDSNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+ $PDSH $MDSNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
}
do_client() {
- $PDSH $CLIENT "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+ $PDSH $CLIENT "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
}
do_ost() {
- $PDSH $OSTNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@"
+ $PDSH $OSTNODE "PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests; cd $PWD; $@" || exit $?
}
drop_request() {
lmc -m $CONFIG --add net --node $NODE --nid `h2$NETWORKTYPE $NODE` \
--nettype $NETWORKTYPE || exit 4
done
- lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --dev $MDSDEV \
- --size $MDSSIZE || exit 5
- lmc -m $CONFIG --add ost --node $OSTNODE --ost ost1 --dev $OSTDEV \
- --size $OSTSIZE || exit 6
+ lmc -m $CONFIG --add mds --node $MDSNODE --mds mds1 --fstype $FSTYPE \
+ --dev $MDSDEV --size $MDSSIZE || exit 5
+ lmc -m $CONFIG --add lov --lov lov1 --mds mds1 --stripe_sz 65536 \
+ --stripe_cnt 0 --stripe_pattern 0 || exit 6
+ lmc -m $CONFIG --add ost --nspath /mnt/ost_ns --node $OSTNODE \
+ --lov lov1 --dev $OSTDEV --size $OSTSIZE --fstype $FSTYPE || exit 7
lmc -m $CONFIG --add mtpt --node $CLIENT --path $MOUNTPT --mds mds1 \
- --ost ost1 || exit 7
+ --lov lov1 || exit 8
}
start_mds() {
make_config
start_mds ${REFORMAT:---reformat}
start_ost ${REFORMAT:---reformat}
- mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
+ mount_client --timeout=${TIMEOUT:-5} --lustre_upcall=/bin/true
}
cleanup() {
do_mds "echo 0 > /proc/sys/lustre/fail_loc"
- unmount_client $@ || true
- shutdown_mds $@ || true
- shutdown_ost $@ || true
+ unmount_client $@ || exit 97
+ shutdown_mds $@ || exit 98
+ shutdown_ost $@ || exit 99
}
wait_for_timeout() {
try_to_cleanup() {
kill -INT $!
- unmount_client --force
- mount_client --timeout=${TIMEOUT:-5} --recovery_upcall=/bin/true
+ unmount_client --force --dump /tmp/client-cleanup-`date +%s`.log
+ mount_client --timeout=${TIMEOUT:-5} --lustre_upcall=/bin/true
}
if [ ! -z "$ONLY" ]; then
exit $?
fi
-setup
+$SETUP
+
drop_request "mcreate /mnt/lustre/1" & wait_for_timeout
try_to_cleanup
drop_request "munlink /mnt/lustre/link1" & wait_for_timeout
try_to_cleanup
-cleanup
+$CLEANUP '--dump /tmp/`hostname`-cleanup.log'