From 191a95eefa5ca9def6bf96c71486a5b25a7ae846 Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 23 Apr 2002 07:28:39 +0000 Subject: [PATCH] Update scripts to use name2dev. For OST devices, use "OBDDEV" for all types (ext2obd,filterobd,echo) so that you can clean them all up the same way. --- lustre/tests/common.sh | 70 ++++++++++++++++-------------------------- lustre/tests/llext3.sh | 13 +++++--- lustre/tests/llmount.sh | 2 +- lustre/tests/llmountcleanup.sh | 8 +++-- lustre/tests/llrext3.sh | 15 +++++---- lustre/tests/runfailure-mds | 30 ++++++++++-------- lustre/tests/runfailure-net | 6 ++-- 7 files changed, 72 insertions(+), 72 deletions(-) diff --git a/lustre/tests/common.sh b/lustre/tests/common.sh index 4245861..bdd9ed1 100644 --- a/lustre/tests/common.sh +++ b/lustre/tests/common.sh @@ -112,6 +112,10 @@ setup_opts() { echo "error: no config file on command-line and no $DEF" 1>&2 exit -1 fi + + [ -z "$MDS_RSH" ] && MDS_RSH="eval" + [ -z "$OST_RSH" ] && OST_RSH="eval" + [ -z "$OSC_RSH" ] && OSC_RSH="eval" } setup_portals() { @@ -205,7 +209,8 @@ setup_mds() { return -1 fi - if [ "$1" != "new_fs" -a "$1" != "old_fs" ]; then + [ "$1" ] && DO_FS=$1 + if [ "$DO_FS" != "new_fs" -a "$DO_FS" != "old_fs" ]; then echo "usage: setup_mds {new_fs|old_fs}" 1>&2 return -1 fi @@ -268,7 +273,7 @@ setup_ost() { $OBDCTL <<- EOF device ${OBD_DEVNO} - attach ${OSTTYPE} OSTDEV + attach ${OSTTYPE} OBDDEV setup ${OBD} ${OBDARG} device ${OST_DEVNO} attach ost OSTDEV @@ -284,8 +289,12 @@ setup_server() { setup_osc() { [ "$SETUP_OSC" != "y" ] && return 0 + RPC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1` OSC_DEVNO=$DEVNO; DEVNO=`expr $DEVNO + 1` $OBDCTL <<- EOF || return $rc + device ${RPC_DEVNO} + attach ptlrpc RPCDEV + setup device ${OSC_DEVNO} attach osc OSCDEV setup -1 @@ -313,27 +322,21 @@ DEBUG_ON="echo 0xffffffff > /proc/sys/portals/debug" DEBUG_OFF="echo 0 > /proc/sys/portals/debug" debug_server_off() { - if [ "$SERVER" != "$LOCALHOST" ]; then - $RSH $SERVER "$DEBUG_OFF" - else - $DEBUG_OFF - fi + [ "$MDS_RSH" ] && echo "Turn OFF debug on MDS" && $MDS_RSH "$DEBUG_OFF" + [ "$OST_RSH" ] && echo "Turn OFF debug on OST" && $OST_RSH "$DEBUG_OFF" } debug_server_on() { - if [ "$SERVER" != "$LOCALHOST" ]; then - $RSH $SERVER "$DEBUG_ON" - else - $DEBUG_ON - fi + [ "$MDS_RSH" ] && echo "Turn ON debug on MDS" && $MDS_RSH "$DEBUG_ON" + [ "$OST_RSH" ] && echo "Turn ON debug on OST" && $OST_RSH "$DEBUG_ON" } debug_client_off() { - $DEBUG_OFF + echo "Tuning OFF debug on client" && $OSC_RSH "$DEBUG_OFF" } debug_client_on() { - $DEBUG_ON + echo "Tuning ON debug on client" && $OSC_RSH "$DEBUG_ON" } cleanup_portals() { @@ -355,23 +358,6 @@ cleanup_portals() { cleanup_lustre() { killall acceptor - $OBDCTL <<- EOF - device 3 - cleanup - detach - device 2 - cleanup - detach - device 1 - cleanup - detach - device 0 - cleanup - detach - quit - EOF - - losetup -d ${LOOP}0 losetup -d ${LOOP}1 losetup -d ${LOOP}2 @@ -397,7 +383,7 @@ cleanup_mds() { [ "$SETUP" ] || MDS_DEVNO=0 $OBDCTL <<- EOF - device ${MDS_DEVNO} + name2dev MDSDEV cleanup detach quit @@ -407,16 +393,11 @@ cleanup_mds() { cleanup_ost() { [ "$SETUP" -a -z "$SETUP_OST" ] && return 0 - if [ -z "$SETUP" ]; then - OST_DEVNO=2 - OBD_DEVNO=1 - fi - $OBDCTL <<- EOF - device ${OST_DEVNO} + name2dev OSTDEV cleanup detach - device ${OBD_DEVNO} + name2dev OBDDEV cleanup detach quit @@ -424,7 +405,7 @@ cleanup_ost() { } cleanup_server() { - cleanup_mds && cleanup_ost + cleanup_ost && cleanup_mds DEVNO=0 } @@ -432,7 +413,7 @@ cleanup_mount() { [ "$SETUP" -a -z "$SETUP_MOUNT" ] && return 0 [ "$OSCMT" ] || OSCMT=/mnt/lustre - umount $OSCMT + umount $OSCMT || fail "unable to unmount $OSCMT" } cleanup_osc() { @@ -441,7 +422,7 @@ cleanup_osc() { [ "$SETUP" ] || OSC_DEVNO=3 $OBDCTL <<- EOF - device ${OSC_DEVNO} + name2dev OSCDEV cleanup detach quit @@ -454,6 +435,7 @@ cleanup_client() { } fail() { - echo $1 - exit 1 + echo "ERROR: $1" 1>&2 + [ $2 ] && RC=$2 || RC=1 + exit $RC } diff --git a/lustre/tests/llext3.sh b/lustre/tests/llext3.sh index 5d2444b..9ad14b2 100755 --- a/lustre/tests/llext3.sh +++ b/lustre/tests/llext3.sh @@ -10,6 +10,8 @@ PORT=1234 setup_portals setup_lustre +echo -n "Hit return to continue..." +read new_fs ext2 /tmp/ost 10000 OST=$LOOPDEV @@ -30,12 +32,15 @@ device 2 attach ost OSTDEV setup 1 device 3 -attach osc OSCDEV -setup -1 -device 4 attach ptlrpc RPCDEV setup +device 4 +attach ldlm LDLMDEV +setup +device 5 +attach osc OSCDEV +setup -1 quit EOF -mount -t lustre_lite -o device=3 none /mnt/lustre +mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre diff --git a/lustre/tests/llmount.sh b/lustre/tests/llmount.sh index 6c89930..bca0e53 100755 --- a/lustre/tests/llmount.sh +++ b/lustre/tests/llmount.sh @@ -26,7 +26,7 @@ device 0 attach mds MDSDEV setup ${MDS} ${MDSFS} device 1 -attach obdfilter FILTERDEV +attach obdfilter OBDDEV setup ${OST} ext2 device 2 attach ost OSTDEV diff --git a/lustre/tests/llmountcleanup.sh b/lustre/tests/llmountcleanup.sh index caa07d3..69d7f75 100755 --- a/lustre/tests/llmountcleanup.sh +++ b/lustre/tests/llmountcleanup.sh @@ -3,7 +3,11 @@ SRCDIR="`dirname $0`" . $SRCDIR/common.sh -umount /mnt/lustre || fail "cannot unmount" +$DEBCTL get_debug > /tmp/debug + +if [ "`mount | grep '/mnt/lustre'`" ]; then + umount /mnt/lustre || fail "cannot unmount" +fi killall acceptor rmmod llite @@ -22,7 +26,7 @@ detach name2dev OSTDEV cleanup detach -name2dev FILTERDEV +name2dev OBDDEV cleanup detach name2dev MDSDEV diff --git a/lustre/tests/llrext3.sh b/lustre/tests/llrext3.sh index c901e01..6c43181 100755 --- a/lustre/tests/llrext3.sh +++ b/lustre/tests/llrext3.sh @@ -24,18 +24,21 @@ device 0 attach mds MDSDEV setup ${MDS} ${MDSFS} device 1 -attach obdext2 OBDEXT2DEV -setup ${OST} +attach obdfilter OBDDEV +setup ${OST} ext2 device 2 attach ost OSTDEV setup 1 device 3 -attach osc OSCDEV -setup -1 -device 4 attach ptlrpc RPCDEV setup +device 4 +attach ldlm LDLMDEV +setup +device 5 +attach osc OSCDEV +setup -1 quit EOF -mount -t lustre_lite -o device=3 none /mnt/lustre +mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre diff --git a/lustre/tests/runfailure-mds b/lustre/tests/runfailure-mds index ebb06d2..cff40b1 100755 --- a/lustre/tests/runfailure-mds +++ b/lustre/tests/runfailure-mds @@ -21,22 +21,28 @@ echo 0xffffffff > /proc/sys/portals/debug $OBDCTL < /proc/sys/lustre/fail_loc @@ -45,7 +51,7 @@ test_fail() { $* echo "Cleaning up and restarting MDS" - umount /mnt/lustre + umount /mnt/lustre || fail "unable to unmount" $OBDCTL <<- EOF device 0 cleanup @@ -61,7 +67,7 @@ test_fail() { setup ${MDS} ${MDSFS} quit EOF - $MOUNT + $MNT } #set -vx @@ -73,22 +79,22 @@ sync # OBD_FAIL_MDS_REINT_SETATTR_WRITE - MDS will discard data from setattr test_fail 0x10a chmod 000 /mnt/lustre/foo ls -l /mnt/lustre/foo -[ ! -x /mnt/lustre/foo ] && echo "/mnt/lustre/foo is not executable!" 1>&2 && exit -1 +[ ! -x /mnt/lustre/foo ] && fail "/mnt/lustre/foo is not executable!" # OBD_FAIL_MDS_REINT_CREATE_WRITE - MDS will not create the file test_fail 0x10c touch /mnt/lustre/bar ls /mnt/lustre/bar -[ $? -eq 0 ] && echo "/mnt/lustre/bar was created!" 1>&2 && exit -1 +[ $? -eq 0 ] && fail "/mnt/lustre/bar was created!" # OBD_FAIL_MDS_REINT_UNLINK_WRITE - MDS will discard data from unlink test_fail 0x10e rm /mnt/lustre/foo ls /mnt/lustre/foo -[ $? -eq 1 ] && echo "/mnt/lustre/foo has been removed!" 1>&2 && exit -1 +[ $? -eq 1 ] && fail "/mnt/lustre/foo has been removed!" # OBD_FAIL_MDS_REINT_RENAME_WRITE - MDS will discard data from rename test_fail 0x112 mv /mnt/lustre/foo /mnt/lustre/bar ls /mnt/lustre/foo /mnt/lustre/bar [ ! -f /mnt/lustre/foo -o -f /mnt/lustre/bar ] && \ - echo "/mnt/lustre/foo has been renamed to bar!" 1>&2 && exit -1 + fail "/mnt/lustre/foo has been renamed to bar!" echo "Done." diff --git a/lustre/tests/runfailure-net b/lustre/tests/runfailure-net index 1442f23..078e1a4 100755 --- a/lustre/tests/runfailure-net +++ b/lustre/tests/runfailure-net @@ -13,13 +13,13 @@ test_fail() { kill -9 $! echo 0 > /proc/sys/lustre/fail_loc - umount /mnt/lustre || exit 1 - mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre || exit 1 + umount /mnt/lustre || fail "cannot unmount /mnt/lustre" + mount -t lustre_lite -o device=`$OBDCTL name2dev OSCDEV` none /mnt/lustre || fail "cannot remount device '`$OBDCTL name2dev OSCDEV`' on /mnt/lustre" } [ -c /dev/request ] || mknod /dev/request c 10 244 -echo | sh llmount.sh || exit -1 +[ "`mount | grep /mnt/lustre`" ] || echo | sh llmount.sh || exit -1 # GETATTR_NET - ls will hang on the getattr test_fail 0x102 ls -l /mnt/lustre -- 1.8.3.1