From 92183fa4921879c07f63c316e0cae0d736ab627a Mon Sep 17 00:00:00 2001 From: grev Date: Fri, 17 Oct 2008 19:12:34 +0000 Subject: [PATCH] b=16551 i=Adilger fix for remote [mds|ost] with nodsh --- lustre/tests/sanity.sh | 142 +++++++++++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 58 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index a40e440..a5f5c2e 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -919,25 +919,25 @@ reset_enospc() { [ "$1" ] && FAIL_LOC=$1 || FAIL_LOC=0 mkdir -p $DIR/d27/nospc rmdir $DIR/d27/nospc - lctl set_param fail_loc=$FAIL_LOC + do_nodes $(comma_list $(osts_nodes)) lctl set_param fail_loc=$FAIL_LOC } exhaust_precreations() { OSTIDX=$1 - OST=$(lctl get_param -n lov.${LOVNAME}.target_obd | - grep ${OSTIDX}": " | \ - awk '{print $2}' | sed -e 's/_UUID$//') + + OST=$(lfs osts | grep ${OSTIDX}": " | \ + awk '{print $2}' | sed -e 's/_UUID$//') # on the mdt's osc - last_id=$(lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_last_id) - next_id=$(lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_next_id) + last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_last_id) + next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc_next_id) - mkdir -p $DIR/d27/${OST} + mkdir -p $DIR/d27/${OST} $SETSTRIPE $DIR/d27/${OST} -i $OSTIDX -c 1 #define OBD_FAIL_OST_ENOSPC 0x215 - lctl set_param fail_loc=0x215 + do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x215 echo "Creating to objid $last_id on ost $OST..." createmany -o $DIR/d27/${OST}/f $next_id $((last_id - next_id + 2)) - lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc* | grep '[0-9]' + do_facet $SINGLEMDS lctl get_param -n osc.*${OST}-osc-MDT0000.prealloc* | grep '[0-9]' reset_enospc $2 } @@ -951,7 +951,8 @@ exhaust_all_precreations() { test_27n() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc rm -f $DIR/d27/f27n @@ -965,7 +966,8 @@ run_test 27n "create file with some full OSTs ==================" test_27o() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc rm -f $DIR/d27/f27o @@ -981,7 +983,8 @@ run_test 27o "create file with all full OSTs (should error) ====" test_27p() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc rm -f $DIR/d27/f27p @@ -1000,7 +1003,8 @@ run_test 27p "append to a truncated file with some full OSTs ===" test_27q() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc rm -f $DIR/d27/f27q @@ -1020,7 +1024,8 @@ run_test 27q "append to truncated file with all OSTs full (should error) ===" test_27r() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_enospc rm -f $DIR/d27/f27r @@ -1051,7 +1056,7 @@ run_test 27t "check that utils parse path correctly" test_27u() { # bug 4900 [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return #define OBD_FAIL_MDS_OSC_PRECREATE 0x13d @@ -1071,7 +1076,8 @@ run_test 27u "skip object creation on OSC w/o objects ==========" test_27v() { # bug 4900 [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return exhaust_all_precreations @@ -1688,10 +1694,12 @@ test_36f() { run_test 36f "utime on file racing with OST BRW write ==========" test_36g() { - remote_ost && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return + + mkdir -p $DIR/$tdir export FMD_MAX_AGE=`do_facet ost1 lctl get_param -n obdfilter.*.client_cache_seconds 2> /dev/null | head -n 1` FMD_BEFORE="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" - touch $DIR/d36/$tfile + touch $DIR/$tdir/$tfile sleep $((FMD_MAX_AGE + 12)) FMD_AFTER="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" [ "$FMD_AFTER" -gt "$FMD_BEFORE" ] && \ @@ -2324,14 +2332,21 @@ test_52b() { run_test 52b "immutable flag test (should return errors) =======" test_53() { - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return + + local param + local ostname + local mds_last + local ost_last + local ostnum # only test MDT0000 - for value in `lctl get_param osc.*-osc-MDT0000.prealloc_last_id` ; do + for value in $(do_facet $SINGLEMDS lctl get_param osc.*-osc-MDT0000.prealloc_last_id) ; do param=`echo ${value[0]} | cut -d "=" -f1` + mds_last=$(do_facet $SINGLEMDS lctl get_param -n $param) ostname=`echo $param | cut -d "." -f2 | cut -d - -f 1-2` - ost_last=`lctl get_param -n obdfilter.$ostname.last_id | head -n 1` - mds_last=`lctl get_param -n $param` + ost_last=$(do_facet ost$ostnum lctl get_param -n obdfilter.$ostname.last_id | head -n 1) echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" if [ $ost_last != $mds_last ]; then error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" @@ -2681,12 +2696,13 @@ run_test 56q "check lfs find -gid and ! -gid ===============================" test_57a() { # note test will not do anything if MDS is not local - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + local MNTDEV="osd.*MDT*.mntdev" - DEV=$(lctl get_param -n $MNTDEV) + DEV=$(do_facet $SINGLEMDS lctl get_param -n $MNTDEV) [ -z "$DEV" ] && error "can't access $MNTDEV" - for DEV in `lctl get_param -n $MNTDEV`; do - dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV" + for DEV in $(do_facet $SINGLEMDS lctl get_param -n $MNTDEV); do + do_facet $SINGLEMDS dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV" DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump` [ "$DEVISIZE" -gt 128 ] || error "inode size $DEVISIZE" rm $TMP/t57a.dump @@ -2972,7 +2988,7 @@ run_test 65j "set default striping on root directory (bug 6367)=" test_65k() { # bug11679 [ "$OSTCOUNT" -lt 2 ] && skip "too few OSTs" && return - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return echo "Check OST status: " MDS_OSCS=`do_facet $SINGLEMDS lctl dl | awk '/[oO][sS][cC].*md[ts]/ { print $4 }'` @@ -3081,28 +3097,27 @@ run_test 68 "support swapping to Lustre ========================" # bug5265, obdfilter oa2dentry return -ENOENT # #define OBD_FAIL_OST_ENOENT 0x217 test_69() { - [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \ - skip "skipping test for remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return f="$DIR/$tfile" - touch $f + $SETSTRIPE $f -c 1 -i 0 $DIRECTIO write ${f}.2 0 1 || error "directio write error" - lctl set_param fail_loc=0x217 + do_facet ost1 lctl set_param fail_loc=0x217 truncate $f 1 # vmtruncate() will ignore truncate() error. $DIRECTIO write $f 0 2 && error "write succeeded, expect -ENOENT" - lctl set_param fail_loc=0 + do_facet ost1 lctl set_param fail_loc=0 $DIRECTIO write $f 0 2 || error "write error" cancel_lru_locks osc $DIRECTIO read $f 0 1 || error "read error" - lctl set_param fail_loc=0x217 + do_facet ost1 lctl set_param fail_loc=0x217 $DIRECTIO read $f 1 1 && error "read succeeded, expect -ENOENT" - lctl set_param fail_loc=0 + do_facet ost1 lctl set_param fail_loc=0 rm -f $f } run_test 69 "verify oa2dentry return -ENOENT doesn't LBUG ======" @@ -3452,29 +3467,31 @@ test_77f() { # bug 10889 run_test 77f "repeat checksum error on write (expect error) ====" test_77g() { # bug 10889 - [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \ - skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return + [ ! -f $F77_TMP ] && setup_f77 + + $SETSTRIPE $DIR/f77g -c 1 -i 0 #define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a - lctl set_param fail_loc=0x8000021a + do_facet ost1 lctl set_param fail_loc=0x8000021a set_checksums 1 - dd if=$F77_TMP of=$DIR/f77 bs=1M count=$F77SZ || \ + dd if=$F77_TMP of=$DIR/f77g bs=1M count=$F77SZ || \ error "write error: rc=$?" - lctl set_param fail_loc=0 + do_facet ost1 lctl set_param fail_loc=0 set_checksums 0 } run_test 77g "checksum error on OST write ======================" test_77h() { # bug 10889 - [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \ - skip "remote OST" && return - [ ! -f $DIR/f77 ] && skip "requires 77g - skipping" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return + + [ ! -f $DIR/f77g ] && skip "requires 77g - skipping" && return cancel_lru_locks osc #define OBD_FAIL_OST_CHECKSUM_SEND 0x21b - lctl set_param fail_loc=0x8000021b + do_facet ost1 lctl set_param fail_loc=0x8000021b set_checksums 1 - cmp $F77_TMP $DIR/f77 || error "file compare failed" - lctl set_param fail_loc=0 + cmp $F77_TMP $DIR/f77g || error "file compare failed" + do_facet ost1 lctl set_param fail_loc=0 set_checksums 0 } run_test 77h "checksum error on OST read =======================" @@ -3547,14 +3564,12 @@ test_78() { # bug 10901 run_test 78 "handle large O_DIRECT writes correctly ============" test_79() { # bug 12743 - [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && - skip "skipping test for remote OST" && return - wait_delete_completed - BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'` - BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'` - BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'` + BKTOTAL=$(calc_osc_kbytes kbytestotal) + BKFREE=$(calc_osc_kbytes kbytesfree) + BKAVAIL=$(calc_osc_kbytes kbytesavail) + STRING=`df -P $MOUNT | tail -n 1 | awk '{print $2","$3","$4}'` DFTOTAL=`echo $STRING | cut -d, -f1` DFUSED=`echo $STRING | cut -d, -f2` @@ -4335,7 +4350,6 @@ free_min_max () { test_116() { [ "$OSTCOUNT" -lt "2" ] && skip "$OSTCOUNT < 2 OSTs" && return - remote_mds && skip "remote MDS" && return echo -n "Free space priority " lctl get_param -n lov.*-clilov-*.qos_prio_free @@ -4467,7 +4481,7 @@ run_test 118a "verify O_SYNC works ==========" test_118b() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4503,7 +4517,7 @@ run_test 118b "Reclaim dirty pages on fatal error ==========" test_118c() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4547,7 +4561,7 @@ run_test 118c "Fsync blocks on EROFS until dirty pages are flushed ==========" test_118d() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4655,7 +4669,7 @@ test_118g() { run_test 118g "Don't stay in wait if we got local -ENOMEM ==========" test_118h() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4690,7 +4704,7 @@ test_118h() { run_test 118h "Verify timeout in handling recoverables errors ==========" test_118i() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4728,7 +4742,7 @@ test_118i() { run_test 118i "Fix error before timeout in recoverable error ==========" test_118j() { - remote_ost_nodsh && skip "remote OST" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return reset_async @@ -4764,6 +4778,8 @@ run_test 118j "Simulate unrecoverable OST side error ==========" test_118k() { + remote_ost_nodsh && skip "remote OSTs with nodsh" && return + #define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e set_nodes_failloc "$(osts_nodes)" 0x20e mkdir -p $DIR/$tdir @@ -5359,6 +5375,7 @@ set_dir_limits () { } test_129() { [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0 + remote_mds_nodsh && skip "remote MDS with nodsh" && return EFBIG=27 MAX=16384 @@ -5749,6 +5766,7 @@ check_file_in_pool() } test_200a() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return do_facet mgs $LCTL pool_new $FSNAME.$POOL do_facet mgs $LCTL get_param -n lov.$FSNAME-MDT0000-mdtlov.pools.$POOL [ $? == 0 ] || error "Pool creation of $POOL failed" @@ -5756,6 +5774,7 @@ test_200a() { run_test 200a "Create new pool ==========================================" test_200b() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return TGT=$(seq -f $FSNAME-OST%04g_UUID $TGTPOOL_FIRST $TGTPOOL_STEP \ $TGTPOOL_MAX | tr '\n' ' ') do_facet mgs $LCTL pool_add $FSNAME.$POOL \ @@ -5767,6 +5786,7 @@ test_200b() { run_test 200b "Add targets to a pool ====================================" test_200c() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $POOL_DIR $SETSTRIPE -c 2 -p $POOL $POOL_DIR [ $? = 0 ] || error "Cannot set pool $POOL to $POOL_DIR" @@ -5774,12 +5794,14 @@ test_200c() { run_test 200c "Set pool on a directory =================================" test_200d() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return res=$($GETSTRIPE $POOL_DIR | grep pool: | cut -f8 -d " ") [ "$res" = $POOL ] || error "Pool on $POOL_DIR is not $POOL" } run_test 200d "Check pool on a directory ===============================" test_200e() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return failed=0 for i in $(seq -w 1 $(($TGT_COUNT * 3))) do @@ -5796,6 +5818,7 @@ test_200e() { run_test 200e "Check files allocation from directory pool ==============" test_200f() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $POOL_FILE failed=0 for i in $(seq -w 1 $(($TGT_COUNT * 3))) @@ -5813,6 +5836,7 @@ test_200f() { run_test 200f "Create files in a pool ===================================" test_200g() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return TGT=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-MDT0000-mdtlov.pools.$POOL | head -1) do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT res=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-MDT0000-mdtlov.pools.$POOL | grep $TGT) @@ -5821,6 +5845,7 @@ test_200g() { run_test 200g "Remove a target from a pool =============================" test_200h() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return for TGT in $(do_facet mgs $LCTL get_param -n lov.$FSNAME-MDT0000-mdtlov.pools.$POOL) do do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT @@ -5831,6 +5856,7 @@ test_200h() { run_test 200h "Remove all targets from a pool ==========================" test_200i() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return do_facet mgs $LCTL pool_destroy $FSNAME.$POOL res=$(do_facet mgs "$LCTL get_param -n lov.$FSNAME-MDT0000-mdtlov.pools.$POOL 2>/dev/null") [ "$res" = "" ] || error "Pool $FSNAME.$POOL is not destroyed" -- 1.8.3.1