Whamcloud - gitweb
b=12613
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index a61e502..2a5f580 100644 (file)
@@ -12,7 +12,7 @@ set -e
 ONLY=${ONLY:-"$*"}
 
 # These tests don't apply to mountconf
-MOUNTCONFSKIP="9 10 11 12 13 13b 14 15 18"
+MOUNTCONFSKIP="9 10 11 12 13 13b 14 15"
 
 # bug number for skipped test:
 ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT $MOUNTCONFSKIP 16 23"
@@ -22,6 +22,7 @@ SRCDIR=`dirname $0`
 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
 
 PTLDEBUG=${PTLDEBUG:--1}
+SAVE_PWD=$PWD
 LUSTRE=${LUSTRE:-`dirname $0`/..}
 RLUSTRE=${RLUSTRE:-$LUSTRE}
 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
@@ -682,11 +683,12 @@ run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should ret
 test_18() {
         [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
         echo "mount mds with large journal..."
-        OLDMDSSIZE=$MDSSIZE
-        MDSSIZE=2000000
-       #FIXME have to change MDS_MKFS_OPTS
-        gen_config
+        local myMDSSIZE=2000000
+        OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
+
+        MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
 
+        gen_config
         echo "mount lustre system..."
        setup
         check_mount || return 41
@@ -694,14 +696,14 @@ test_18() {
         echo "check journal size..."
         FOUNDSIZE=`do_facet mds "debugfs -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
         if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
-                log "Success: mkfs creates large journals"
+                log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
         else
                 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
         fi
 
         cleanup || return $?
 
-        MDSSIZE=$OLDMDSSIZE
+        MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
         gen_config
 }
 run_test 18 "check mkfs creates large journals"
@@ -919,9 +921,9 @@ set_and_check() {
            FINAL=$(($ORIG + 5))
        fi
        echo "Setting $PARAM from $ORIG to $FINAL"
-       $LCTL conf_param $PARAM=$FINAL
+       do_facet mds "$LCTL conf_param $PARAM=$FINAL" || error conf_param failed
        local RESULT
-       local MAX=20
+       local MAX=90
        local WAIT=0
        while [ 1 ]; do
            sleep 5
@@ -1007,14 +1009,23 @@ test_29() {
 
        # check MDT too 
        local MPROC="$LPROC/osc/$FSNAME-OST0001-osc-[M]*/active"
-        RESULT=`do_facet mds " [ -r $MPROC ] && cat $MPROC"`
-        [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
-        if [ $RESULT -ne $DEAC ]; then
-            echo "MDT not deactivated: $RESULT"
-            return 4
-        else
-           echo "MDT deactivated also"
-       fi
+       local MAX=30
+       local WAIT=0
+       while [ 1 ]; do
+           sleep 5
+           RESULT=`do_facet mds " [ -r $MPROC ] && cat $MPROC"`
+           [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
+           if [ $RESULT -eq $DEAC ]; then
+               echo "MDT deactivated also after $WAIT sec (got $RESULT)"
+               break
+           fi
+           WAIT=$((WAIT + 5))
+           if [ $WAIT -eq $MAX ]; then
+               echo "MDT not deactivated: wanted $DEAC got $RESULT"
+               return 4
+           fi
+           echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
+       done
 
         # test new client starts deactivated
        umount_client $MOUNT || return 200
@@ -1071,8 +1082,9 @@ test_32a() {
         #       devices
         # or maybe this test is just totally useless on a client-only system
         [ -z "$TUNEFS" ] && skip "No tunefs" && return
-        [ ! -r disk1_4.zip ] && skip "Cant find disk1_4.zip, skipping" && return
-       unzip -o -j -d $TMP/$tdir disk1_4.zip || { skip "Cant unzip disk1_4, skipping" && return ; }
+       local DISK1_4=$LUSTRE/tests/disk1_4.zip
+        [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
+       unzip -o -j -d $TMP/$tdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
        load_modules
        sysctl lnet.debug=$PTLDEBUG
 
@@ -1127,8 +1139,9 @@ test_32b() {
         #       devices
         # or maybe this test is just totally useless on a client-only system
         [ -z "$TUNEFS" ] && skip "No tunefs" && return
-        [ ! -r disk1_4.zip ] && skip "Cant find disk1_4.zip, skipping" && return
-       unzip -o -j -d $TMP/$tdir disk1_4.zip || { skip "Cant unzip disk1_4, skipping" && return ; }
+       local DISK1_4=$LUSTRE/tests/disk1_4.zip
+        [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
+       unzip -o -j -d $TMP/$tdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
        load_modules
        sysctl lnet.debug=$PTLDEBUG
 
@@ -1157,7 +1170,7 @@ test_32b() {
        # a fully-functioning client
        echo "Check client and old fs contents"
        mount_client $MOUNT
-       set_and_check client "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
+       set_and_check client "cat $LPROC/mdc/*/max_rpcs_in_flight" "${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight" || return 11
        [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12  
        echo "ok."
 
@@ -1201,7 +1214,7 @@ test_35() { # bug 12459
 
        log "Set up a fake failnode for the MDS"
        FAKENID="127.0.0.2"
-       $LCTL conf_param ${FSNAME}-MDT0000.failover.node=$FAKENID || return 4
+       do_facet mds $LCTL conf_param ${FSNAME}-MDT0000.failover.node=$FAKENID || return 4
 
        log "Wait for RECONNECT_INTERVAL seconds (10s)"
        sleep 10
@@ -1239,6 +1252,75 @@ test_35() { # bug 12459
 }
 run_test 35 "Reconnect to the last active server first"
 
+test_36() { # 12743
+        local rc
+        local FSNAME2=test1234
+        local fs2mds_HOST=$mds_HOST
+        local fs2ost_HOST=$ost_HOST
+        local fs3ost_HOST=$ost_HOST
+        rc=0
+
+        [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ] && [ -b "$MDSDEV" ] && \
+            log "mixed loopback and real device not working" && return
+
+        [ $OSTCOUNT -lt 2 ] && skip "skipping test for single OST" && return
+
+        local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
+        local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
+        local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
+        add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
+        add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b1024' --fsname=${FSNAME2} --mgsnode=`hostname`@tcp --reformat $fs2ostdev || exit 10
+        add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=`hostname`@tcp --reformat $fs3ostdev || exit 10
+
+        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
+        start fs2ost $fs2ostdev $OST_MOUNT_OPTS
+        start fs3ost $fs3ostdev $OST_MOUNT_OPTS
+        mkdir -p $MOUNT2
+        mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+
+        dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
+        [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] &&
+                skip "skipping test for remote OST" && return
+        BKTOTAL=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \
+                $LPROC/obdfilter/*/kbytestotal`
+        BKFREE=`awk 'BEGIN{free=0}; {free+=$1}; END{print free}' \
+               $LPROC/obdfilter/*/kbytesfree`
+        BKAVAIL=`awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}' \
+                $LPROC/obdfilter/*/kbytesavail`
+        STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
+        DFTOTAL=`echo $STRING | cut -d, -f1`
+        DFUSED=`echo $STRING  | cut -d, -f2`
+        DFAVAIL=`echo $STRING | cut -d, -f3`
+        DFFREE=$(($DFTOTAL - $DFUSED))
+
+        ALLOWANCE=$((64 * $OSTCOUNT))
+
+        if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||  
+           [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
+                echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
+                rc=1
+        fi
+        if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] || 
+           [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
+                echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
+                rc=2
+        fi
+        if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] || 
+           [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
+                echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
+                rc=3
+       fi
+
+        umount -d $MOUNT2
+        stop fs3ost -f || return 200
+        stop fs2ost -f || return 201
+        stop fs2mds -f || return 202
+        rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
+        unload_modules || return 203
+        return $rc
+}
+run_test 36 "df report consistency on OSTs with different block size"
+
 umount_client $MOUNT   
 cleanup_nocli
 cleanup_krb5_env