mdsfailover_HOST=${mdsfailover_HOST}
mgs_HOST=${mgs_HOST:-$MDSNODE}
ost_HOST=${ost_HOST:-$OSTNODE}
+ostfailover_HOST=${ostfailover_HOST}
ost2_HOST=${ost2_HOST:-$ost_HOST}
client_HOST=${client_HOST:-$CLIENT}
NETTYPE=${NETTYPE:-tcp}
FSTYPE=${FSTYPE:-ext3}
MDS_MKFS_OPTS="--mgs --mdt --index=0 --device-size=$MDSSIZE $MDSOPT"
-OST_MKFS_OPTS="--ost --index=0 --device-size=$OSTSIZE --mgsnid=`h2$NETTYPE $HOSTNAME` $OSTOPT"
-OST2_MKFS_OPTS="--ost --index=1 --device-size=$OSTSIZE --mgsnid=`h2$NETTYPE $HOSTNAME` $OSTOPT"
+OST_MKFS_OPTS="--ost --index=0 --device-size=$OSTSIZE --mgsnode=`h2$NETTYPE $HOSTNAME` $OSTOPT"
+OST2_MKFS_OPTS="--ost --index=1 --device-size=$OSTSIZE --mgsnode=`h2$NETTYPE $HOSTNAME` $OSTOPT"
MDS_MOUNT_OPTS="-o loop"
OST_MOUNT_OPTS="-o loop"
check_mount() {
do_facet client "touch $DIR/a" || return 71
do_facet client "rm $DIR/a" || return 72
- # make sure lustre is actually mounted
+ # make sure lustre is actually mounted (touch will block,
+ # but grep won't, so do it after)
do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
echo "setup single mount lustre success"
}
# mountconf setup of MDS and two OSTs
-export PATH=`dirname $0`/../utils:$PATH
-
-LUSTRE=${LUSTRE:-`dirname $0`/..}
-. $LUSTRE/tests/test-framework.sh
-
-init_test_env $@
-
-. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
+#export PATH=`dirname $0`/../utils:$PATH
+#LUSTRE=${LUSTRE:-`dirname $0`/..}
+#. $LUSTRE/tests/test-framework.sh
+#init_test_env $@
+#. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
stop_all() {
export MCSETUP=${MCSETUP:-"mcsetup"}
export MCCLEANUP=${MCCLEANUP:-"mccleanup"}
-
-#${LCONF} $NOMOD $portals_opt $lustre_opt $debug_opt $node_opt ${REFORMAT:---reformat} $@ $conf_opt || {
- # maybe acceptor error, dump tcp port usage
-# netstat -tpn
-# exit 2
-#}
-
-#if [ "$MOUNT2" ]; then
-# $LLMOUNT -v -o user_xattr,acl `hostname`:/mds1/client $MOUNT2 || exit 3
-#fi
ALWAYS_EXCEPT="20b 24 27 $RECOVERY_SMALL_EXCEPT"
LUSTRE=${LUSTRE:-`dirname $0`/..}
-
. $LUSTRE/tests/test-framework.sh
-
init_test_env $@
-
. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
build_test_filter
-
# Allow us to override the setup if we already have a mounted system by
# setting SETUP=" " and CLEANUP=" "
SETUP=${SETUP:-"setup"}
CLEANUP=${CLEANUP:-"cleanup"}
-FORCE=${FORCE:-"-f"}
-make_config() {
- rm -f $XMLCONFIG
- add_mds mds --dev $MDSDEV --size $MDSSIZE
- add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
- --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
- add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
- add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
- add_client client mds --lov lov1 --path $MOUNT
-}
+# for MCSETUP and MCCLEANUP
+. mountconf.sh
setup() {
- make_config
- start ost --reformat $OSTLCONFARGS
- start ost2 --reformat $OSTLCONFARGS
- [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
- start mds $MDSLCONFARGS --reformat
- grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
+ $MCFORMAT
+ $MCSETUP
}
cleanup() {
- zconf_umount `hostname` $MOUNT
- stop mds ${FORCE} $MDSLCONFARGS
- stop ost2 ${FORCE}
- stop ost ${FORCE} --dump $TMP/recovery-small-`hostname`.log
+ $MCCLEANUP > /dev/null || { echo "FAILed to clean up"; exit 20; }
}
if [ ! -z "$EVAL" ]; then
if [ "$ONLY" == "cleanup" ]; then
sysctl -w lnet.debug=0 || true
- FORCE=--force cleanup
+ cleanup
exit
fi
-REFORMAT=--reformat $SETUP
-unset REFORMAT
+$SETUP
[ "$ONLY" == "setup" ] && exit
run_test 3 "stat: drop req, drop rep"
test_4() {
- do_facet client "cp /etc/resolv.conf $MOUNT/resolv.conf" || return 1
- drop_request "cat $MOUNT/resolv.conf > /dev/null" || return 2
- drop_reply "cat $MOUNT/resolv.conf > /dev/null" || return 3
+ do_facet client "cp /etc/passwd $MOUNT/passwd" || return 1
+ drop_request "cat $MOUNT/passwd > /dev/null" || return 2
+ drop_reply "cat $MOUNT/passwd > /dev/null" || return 3
}
run_test 4 "open: drop req, drop rep"
test_5() {
- drop_request "mv $MOUNT/resolv.conf $MOUNT/renamed" || return 1
+ drop_request "mv $MOUNT/passwd $MOUNT/renamed" || return 1
drop_reint_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
do_facet client "checkstat -v $MOUNT/renamed-again" || return 3
}
}
run_test 52 "failover OST under load"
-
-FORCE=--force $CLEANUP
+$CLEANUP
SETUP=${SETUP:-"setup"}
CLEANUP=${CLEANUP:-"cleanup"}
-FORCE=${FORCE:-"--force"}
-
-gen_config() {
- rm -f $XMLCONFIG
- add_mds mds --dev $MDSDEV --size $MDSSIZE
- if [ ! -z "$mdsfailover_HOST" ]; then
- add_mdsfailover mds --dev $MDSDEV --size $MDSSIZE
- fi
-
- add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
- --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
- add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE --failover
- add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE --failover
- add_client client mds --lov lov1 --path $MOUNT
-}
-
-
build_test_filter
cleanup() {
- # make sure we are using the primary MDS, so the config log will
+ # make sure we are using the primary server, so test-framework will
# be able to clean up properly.
activemds=`facet_active mds`
if [ $activemds != "mds" ]; then
fail mds
fi
- umount $MOUNT2 || true
- umount $MOUNT || true
- rmmod llite || true
- stop mds ${FORCE}
- stop ost2 ${FORCE}
- stop ost ${FORCE} --dump $TMP/replay-dual-`hostname`.log
+ grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT
+ grep " $MOUNT2 " /proc/mounts && zconf_umount `hostname` $MOUNT2
+ stop mds -f
+ stop ost2 -f
+ stop ost -f
}
if [ "$ONLY" == "cleanup" ]; then
sysctl -w lnet.debug=0
- FORCE=--force cleanup
+ cleanup
exit
fi
setup() {
- gen_config
- start ost --reformat $OSTLCONFARGS
- start ost2 --reformat $OSTLCONFARGS
- start mds $MDSLCONFARGS --reformat
- grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
- grep " $MOUNT2 " /proc/mounts || zconf_mount `hostname` $MOUNT2
-
-# echo $TIMEOUT > /proc/sys/lustre/timeout
+ cleanup
+ add mds $MDS_MKFS_OPTS --reformat $MDSDEV
+ add ost $OST_MKFS_OPTS --reformat $OSTDEV
+ add ost2 $OST2_MKFS_OPTS --reformat $OSTDEV2
+ start mds $MDSDEV $MDS_MOUNT_OPTS
+ start ost $OSTDEV $OST_MOUNT_OPTS
+ start ost2 $OSTDEV2 $OST2_MOUNT_OPTS
+ zconf_mount `hostname` $MOUNT
+ zconf_mount `hostname` $MOUNT2
}
$SETUP
equals_msg test complete, cleaning up
SLEEP=$((`date +%s` - $NOW))
[ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
- FORCE=--force $CLEANUP
+ $CLEANUP
fi
. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
+#failover= must be defined in OST_MKFS_OPTIONS if ostfailover_HOST != ost_HOST
# Skip these tests
# BUG NUMBER: 2766?
ALWAYS_EXCEPT="5 $REPLAY_OST_SINGLE_EXCEPT"
gen_config() {
- rm -f $XMLCONFIG
- add_mds mds --dev $MDSDEV --size $MDSSIZE
- add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
- --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
- add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE --failover
- if [ ! -z "$ostfailover_HOST" ]; then
- add_ostfailover ost --dev $OSTDEV --size $OSTSIZE
- fi
- add_client client mds --lov lov1 --path $MOUNT
+ grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT
+ stop ost -f
+ stop ost2 -f
+ stop mds -f
+ echo Formatting mds, ost
+ add mds $MDS_MKFS_OPTS --reformat $MDSDEV
+ add ost $OST_MKFS_OPTS --reformat $OSTDEV
}
cleanup() {
- # make sure we are using the primary MDS, so the config log will
+ # make sure we are using the primary server, so test-framework will
# be able to clean up properly.
activeost=`facet_active ost`
if [ $activeost != "ost" ]; then
fail ost
fi
+
zconf_umount `hostname` $MOUNT
- stop mds ${FORCE} $MDSLCONFARGS
- stop ost ${FORCE} --dump $TMP/replay-ost-single-`hostname`.log
+ stop mds
+ stop ost
+ unload_modules
}
if [ "$ONLY" == "cleanup" ]; then
sysctl -w lnet.debug=0
- FORCE=--force cleanup
+ cleanup
exit
fi
setup() {
gen_config
-
- start ost --reformat $OSTLCONFARGS
+ start mds $MDSDEV $MDS_MOUNT_OPTS
+ start ost $OSTDEV $OST_MOUNT_OPTS
[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
- start mds --reformat $MDSLCONFARGS
if [ -z "`grep " $MOUNT " /proc/mounts`" ]; then
# test "-1" needed during initial client->OST connection
log "== test 00: target handle mismatch (bug 5317) === `date +%H:%M:%S`"
-
#define OBD_FAIL_OST_ALL_REPLY_NET 0x211
do_facet ost "sysctl -w lustre.fail_loc=0x80000211"
-
zconf_mount `hostname` $MOUNT && df $MOUNT && pass || error "mount fail"
fi
}
run_test 7 "Fail OST before obd_destroy"
equals_msg test complete, cleaning up
-FORCE=--force $CLEANUP
+$CLEANUP
build_test_filter
cleanup() {
- grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT
+ # make sure we are using the primary server, so test-framework will
+ # be able to clean up properly.
+ activemds=`facet_active mds`
+ if [ $activemds != "mds" ]; then
+ fail mds
+ fi
+
+ zconf_umount `hostname` $MOUNT
stop ost -f
stop ost2 -f
stop mds -f
- #no dump option in mountconf...
- #stop ost ${FORCE} --dump $TMP/replay-single-`hostname`.log
}
SETUP=${SETUP:-"setup"}
start ost $OSTDEV $OST_MOUNT_OPTS
start ost2 $OSTDEV2 $OST2_MOUNT_OPTS
[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
-
- #add_lov lov1 mds --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
-
grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
}
shift
done
-MOUNT="`mount | awk '/ lustre_lite / { print $3 }' | tail -n 1`"
-if [ -z "$MOUNT" ]; then
+EXISTING_MOUNT="`mount | awk '/ lustre(_lite)? / { print $3 }' | tail -n 1`"
+if [ -z "$EXISTING_MOUNT" ]; then
sh llmount.sh $OPTS
- MOUNT="`mount | awk '/ lustre_lite / { print $3 }' | tail -n 1`"
- [ -z "$MOUNT" ] && fail "no lustre filesystem mounted" 1
+ EXISTING_MOUNT="`mount | awk '/ lustre(_lite)? / { print $3 }' | tail -n 1`"
+ [ -z "$EXISTING_MOUNT" ] && fail "no lustre filesystem mounted" 1
I_MOUNTED="yes"
fi
SAVE_PWD=$PWD
# for MCSETUP and MCCLEANUP
+LUSTRE=${LUSTRE:-`dirname $0`/..}
+. $LUSTRE/tests/test-framework.sh
+init_test_env $@
+. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
. mountconf.sh
cleanup() {
log "cleanup: ======================================================"
if [ "`mount | grep ^$NAME`" ]; then
- rm -rf $DIR/[Rdfs][1-9]*
- if [ "$I_MOUNTED" = "yes" ]; then
- $MCCLEANUP || error "cleanup failed"
- fi
+ rm -rf $DIR/[Rdfs][1-9]*
+fi
+if [ "$I_MOUNTED" = "yes" ]; then
+ $MCCLEANUP || error "cleanup failed"
fi
+
echo '=========================== finished ==============================='
[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
SAVE_PWD=$PWD
# for MCSETUP and MCCLEANUP
+LUSTRE=${LUSTRE:-`dirname $0`/..}
+. $LUSTRE/tests/test-framework.sh
+init_test_env $@
+. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
. mountconf.sh
cleanup() {
log "cleanup: ======================================================"
rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
+if [ "$I_MOUNTED" = "yes" ]; then
+ $MCCLEANUP || error "cleanup failed"
+fi
echo '=========================== finished ==============================='
[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
stop() {
facet=$1
shift
- local running=`do_facet ${facet} grep -c /mnt/${facet}" " /proc/mounts`
+ local running=`do_facet ${facet} "grep -c /mnt/${facet}' ' /proc/mounts"`
if [ $running -ne 0 ]; then
echo "Stopping /mnt/${facet} (opts:$@)"
do_facet ${facet} umount -d $@ /mnt/${facet}
if (errno == ENOENT)
fprintf(stderr,"Is the mgs specification correct? "
"(%s)\n", source);
+ if (errno == EALREADY)
+ fprintf(stderr,"This service is already running. "
+ "(%s)\n", source);
rc = errno;
} else if (!nomtab) {
rc = update_mtab_entry(source, target, "lustre", options,0,0,0);