From: nathan Date: Wed, 22 Mar 2006 20:00:00 +0000 (+0000) Subject: Branch b1_4_mountconf X-Git-Tag: v1_8_0_110~486^2~2136^2~6 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=268a5b625e2d9bb7d61d37852031fc75d94e94bd;p=fs%2Flustre-release.git Branch b1_4_mountconf b=9858 replace llmount/llmountcleanup with mountconf.sh fix sanity --- diff --git a/lustre/tests/llmount.sh b/lustre/tests/llmount.sh index c7835f9..80fa2b3 100755 --- a/lustre/tests/llmount.sh +++ b/lustre/tests/llmount.sh @@ -29,7 +29,7 @@ fi [ "$DEBUG" ] && debug_opt="--ptldebug=$DEBUG" [ "$PTLDEBUG" ] && debug_opt="--ptldebug=$PTLDEBUG" -echo llmount: FIXME use the utils/cluster_scripts/cluster_config.sh to parse config csv files. +echo llmount: FIXME replace llmount.sh with ". mountconf.sh" and "$SETUP" exit 1 diff --git a/lustre/tests/llmountcleanup.sh b/lustre/tests/llmountcleanup.sh index deca747..7d8eda9 100755 --- a/lustre/tests/llmountcleanup.sh +++ b/lustre/tests/llmountcleanup.sh @@ -33,7 +33,7 @@ fi #${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \ --dump $TMP/debug $conf_opt -echo FIXME this must be umount of some sort +echo FIXME llmountcleanup should be replaced with $CLEANUP exit 1 rc=$? diff --git a/lustre/tests/mountconf.sh b/lustre/tests/mountconf.sh new file mode 100755 index 0000000..ae23b38 --- /dev/null +++ b/lustre/tests/mountconf.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +#set -vx + +# 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} + + +unload_modules() { + $LCTL dk $TMP/debug + $LCTL modules | awk '{ print $2 }' | xargs rmmod >/dev/null 2>&1 + # do it again, in case we tried to unload ksocklnd too early + LNET=$(lsmod | grep -c lnet) + if [ $LNET -ne 0 ]; then + $LCTL modules | awk '{ print $2 }' | xargs rmmod + fi + lsmod | grep lnet && echo "modules still loaded" && exit 1 + + LEAK_LUSTRE=`dmesg | tail -n 30 | grep "obd mem.*leaked"` + LEAK_PORTALS=`dmesg | tail -n 20 | grep "Portals memory leaked"` + if [ "$LEAK_LUSTRE" -o "$LEAK_PORTALS" ]; then + echo "$LEAK_LUSTRE" 1>&2 + echo "$LEAK_PORTALS" 1>&2 + mv $TMP/debug $TMP/debug-leak.`date +%s` + echo "Memory leaks detected" + exit 254 + fi +} + +stop_all() { + grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT + stop ost -f + stop ost2 -f + stop mds -f +} + +mccleanup() { + echo "mountconf cleanup $*" + stop_all + unload_modules +} + +REFORMAT=${REFORMAT:---reformat} + +format() { + stop_all + echo Formatting mds, ost, ost2 + add mds $MDS_MKFS_OPTS $REFORMAT $MDSDEV > /dev/null || exit 10 + add ost $OST_MKFS_OPTS $REFORMAT $OSTDEV > /dev/null || exit 10 + add ost2 $OST2_MKFS_OPTS $REFORMAT $OSTDEV2 > /dev/null || exit 10 +} +format + +mcsetup() { + echo Setup mds, ost, ost2 + start mds $MDSDEV $MDS_MOUNT_OPTS + start ost $OSTDEV $OST_MOUNT_OPTS + start ost2 $OSTDEV2 $OST2_MOUNT_OPTS + [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE + + grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT + sleep 5 +} + +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 diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index dd23849..c6ac769c 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -35,7 +35,7 @@ CLEANUP=${CLEANUP:-"cleanup"} if [ "$ONLY" == "cleanup" ]; then sysctl -w lnet.debug=0 || true $CLEANUP - exit + exit 0 fi setup() { @@ -51,7 +51,6 @@ setup() { #add_lov lov1 mds --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT - sleep 10 } $SETUP @@ -1065,4 +1064,4 @@ test_58() { run_test 58 "test recovery from llog for setattr op (test llog_gen_rec)" equals_msg test complete, cleaning up -FORCE=$CLEANUP +$CLEANUP diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 101c7b7..13bdffd 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -66,18 +66,22 @@ export NAME=${NAME:-local} SAVE_PWD=$PWD -clean() { +# for MCSETUP and MCCLEANUP +. mountconf.sh + +cleanup() { echo -n "cln.." - sh llmountcleanup.sh ${FORCE} > /dev/null || { echo "FAILed to clean up"; exit 20; } + $MCCLEANUP ${FORCE} > /dev/null || { echo "FAILed to clean up"; exit 20; } } -CLEAN=${CLEAN:-:} +CLEANUP=${CLEANUP:-:} -start() { +setup() { echo -n "mnt.." - sh llmount.sh > /dev/null || exit 10 + $MCSETUP +#$MCSETUP > /dev/null || exit 10 echo "done" } -START=${START:-:} +SETUP=${SETUP:-:} log() { echo "$*" @@ -113,8 +117,8 @@ basetest() { } run_one() { - if ! mount | grep -q $DIR; then - $START + if ! grep -q $DIR /proc/mounts; then + $SETUP fi testnum=$1 message=$2 @@ -127,7 +131,7 @@ run_one() { unset TESTNAME pass "($((`date +%s` - $BEFORE))s)" cd $SAVE_PWD - $CLEAN + $CLEANUP } build_test_filter() { @@ -200,11 +204,11 @@ pass() { mounted_lustre_filesystems() { awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts } -MOUNT="`mounted_lustre_filesystems`" -if [ -z "$MOUNT" ]; then - sh llmount.sh - MOUNT="`mounted_lustre_filesystems`" - [ -z "$MOUNT" ] && error "NAME=$NAME not mounted" +MOUNTED="`mounted_lustre_filesystems`" +if [ -z "$MOUNTED" ]; then + $MCSETUP + MOUNTED="`mounted_lustre_filesystems`" + [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted" I_MOUNTED=yes fi @@ -731,7 +735,7 @@ test_24n() { $CHECKSTAT ${f}.rename $CHECKSTAT -a ${f} } -run_test 24n "Statting the old file after renameing (Posix rename 2)" +run_test 24n "Statting the old file after renaming (Posix rename 2)" test_24o() { check_kernel_version 37 || return 0 @@ -985,9 +989,9 @@ reset_enospc() { exhaust_precreations() { OSTIDX=$1 - OST=grep ${OSTIDX}": " $LPROC/lov/${LOVNAME}/target_obd | \ - awk '{print $2}' | sed -e 's/_UUID$//' - + OST=$(grep ${OSTIDX}": " $LPROC/lov/${LOVNAME}/target_obd | \ + awk '{print $2}' | sed -e 's/_UUID$//') + # on the mdt's osc last_id=$(cat $LPROC/osc/${OST}-osc/prealloc_last_id) next_id=$(cat $LPROC/osc/${OST}-osc/prealloc_next_id) @@ -1093,10 +1097,10 @@ test_28() { run_test 28 "create/mknod/mkdir with bad file types ============" cancel_lru_locks() { - for d in $LPROC/ldlm/namespaces/*-$1*; do + for d in $LPROC/ldlm/namespaces/*-$1-*; do echo clear > $d/lru_size done - grep "[0-9]" $LPROC/ldlm/namespaces/$1*/lock_unused_count /dev/null + grep "[0-9]" $LPROC/ldlm/namespaces/*-$1-*/lock_unused_count /dev/null } test_29() { @@ -1105,7 +1109,7 @@ test_29() { touch $DIR/d29/foo log 'first d29' ls -l $DIR/d29 - MDCDIR=${MDCDIR:-$LPROC/ldlm/namespaces/*-mdc*} + MDCDIR=${MDCDIR:-$LPROC/ldlm/namespaces/*-mdc-*} LOCKCOUNTORIG=`cat $MDCDIR/lock_count` LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count` log 'second d29' @@ -2454,9 +2458,9 @@ run_test 65i "set default striping on root directory (bug 6367)=" test_65j() { # bug6367 # if we aren't already remounting for each test, do so for this test - if [ "$CLEAN" = ":" ]; then - clean || error "failed to unmount" - start || error "failed to remount" + if [ "$CLEANUP" = ":" ]; then + cleanup || error "failed to unmount" + setup || error "failed to remount" fi $LSTRIPE -d $MOUNT || true } @@ -2940,7 +2944,7 @@ log "cleanup: ======================================================" if [ "`mount | grep ^$NAME`" ]; then rm -rf $DIR/[Rdfs][1-9]* if [ "$I_MOUNTED" = "yes" ]; then - sh llmountcleanup.sh || error "llmountcleanup failed" + $MCCLEANUP || error "cleanup failed" fi fi diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 50418b1..29e430e 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -99,7 +99,7 @@ start() { stop() { facet=$1 shift - local running=`do_facet ${facet} mount | grep -c /mnt/${facet}" "` + 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} @@ -112,8 +112,12 @@ stop() { zconf_mount() { local OPTIONS - client=$1 - mnt=$2 + local client=$1 + local mnt=$2 + if [ -z "$mnt" ]; then + echo No mount point given: zconf_mount $* + exit 1 + fi do_node $client mkdir $mnt 2> /dev/null || :