Whamcloud - gitweb
- tagging RC_CURRENT
[fs/lustre-release.git] / lustre / tests / runfailure-mds
index ebb06d2..f2942c3 100755 (executable)
@@ -3,40 +3,9 @@
 SRCDIR="`dirname $0`"
 . $SRCDIR/common.sh
 
-NETWORK=tcp
-LOCALHOST=localhost
-SERVER=localhost
-PORT=1234
+. $SRCDIR/llmount.sh
 
-setup_portals
-setup_lustre
-
-new_fs ext2 /tmp/ost 10000
-OST=$LOOPDEV
-MDSFS=ext3
-new_fs ${MDSFS} /tmp/mds 10000
-MDS=$LOOPDEV
-
-echo 0xffffffff > /proc/sys/portals/debug
-
-$OBDCTL <<EOF
-device 0
-attach mds
-setup ${MDS} ${MDSFS}
-device 1
-attach obdext2
-setup ${OST}
-device 2
-attach ost
-setup 1
-device 3
-attach osc
-setup -1
-quit
-EOF
-
-MOUNT='mount -t lustre_lite -o device=3 none /mnt/lustre'
-$MOUNT
+MNT="setup_mount"
 
 test_fail() {
        echo $1 > /proc/sys/lustre/fail_loc
@@ -45,9 +14,9 @@ test_fail() {
        $* 
 
        echo "Cleaning up and restarting MDS"
-       umount /mnt/lustre
+       umount /mnt/lustre || fail "unable to unmount"
        $OBDCTL <<- EOF
-       device 0
+       name2dev MDSDEV
        cleanup
        detach
        quit
@@ -56,12 +25,12 @@ test_fail() {
        echo 0 > /proc/sys/lustre/fail_loc
 
        $OBDCTL <<- EOF
-       device 0
-       attach mds
+       newdev
+       attach mds MDSDEV
        setup ${MDS} ${MDSFS}
        quit
        EOF
-       $MOUNT
+       $MNT
 }
 
 #set -vx
@@ -73,22 +42,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."