From 4955bfadad5bff85e2327531b0edf4db012ae60f Mon Sep 17 00:00:00 2001 From: grev Date: Fri, 17 Oct 2008 13:33:00 +0000 Subject: [PATCH] b=16551 i=Adilger fix for remote [mds|ost] with nodsh --- lustre/tests/sanity.sh | 146 ++++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2cf74f93..433c19e 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -897,24 +897,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}": " | \ + + 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.prealloc_last_id) - next_id=$(lctl get_param -n osc.${OST}-osc.prealloc_next_id) + last_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_last_id) + next_id=$(do_facet mds lctl get_param -n osc.${OST}-osc.prealloc_next_id) 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.prealloc* | grep '[0-9]' + do_facet mds "lctl get_param -n osc.${OST}-osc.prealloc*" | grep '[0-9]' reset_enospc $2 } @@ -928,7 +929,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 @@ -942,7 +944,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 @@ -957,7 +960,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 @@ -976,7 +980,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 @@ -996,7 +1001,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 @@ -1027,7 +1033,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 0x139 @@ -1047,7 +1053,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 @@ -1566,10 +1573,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" ] && \ @@ -2220,13 +2229,21 @@ test_52c() { # 12848 simulating client < 1.4.7 run_test 52c "immutable flag test for client < 1.4.7 =======" test_53() { - remote_mds && skip "remote MDS" && return - - for VALUE in `lctl get_param osc.*-osc.prealloc_last_id`; do + 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 + + for VALUE in $(do_facet mds lctl get_param osc.*-osc.prealloc_last_id); do param=`echo ${VALUE[0]} | cut -d "=" -f1`; ostname=`echo $param | cut -d "." -f2 | cut -d - -f 1-2` - mds_last=`lctl get_param -n $param` - ost_last=`lctl get_param -n obdfilter.$ostname.last_id` + mds_last=$(do_facet mds lctl get_param -n $param) + ostnum=$(echo $ostname | sed 's/lustre-OST//g' | awk '{print ($1+0)}' ) + ost_last=$(do_facet ost$ostnum lctl get_param -n obdfilter.$ostname.last_id) 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" @@ -2575,12 +2592,13 @@ test_56q() { run_test 56q "check lfs find -gid and ! -gid ===============================" test_57a() { - remote_mds && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return + local MNTDEV="mds.*.mntdev" - DEV=$(lctl get_param -n $MNTDEV) + DEV=$(do_facet mds 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 mds lctl get_param -n $MNTDEV); do + do_facet mds 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 @@ -2859,7 +2877,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 mds lctl dl | awk '/[oO][sS][cC].*md[ts]/ { print $4 }'` @@ -3020,30 +3038,29 @@ 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" #define OBD_FAIL_OST_ENOENT 0x217 - 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" #define OBD_FAIL_OST_ENOENT 0x217 - 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 ======" @@ -3366,29 +3383,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/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 + 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/f77g || error "file compare failed" - lctl set_param fail_loc=0 + do_facet ost1 lctl set_param fail_loc=0 set_checksums 0 } run_test 77h "checksum error on OST read =======================" @@ -3460,17 +3479,11 @@ 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` @@ -4231,7 +4244,6 @@ free_min_max () { test_116() { [ "$OSTCOUNT" -lt "2" ] && skip "too few OSTs" && return - remote_mds && skip "remote MDS" && return echo -n "Free space priority " lctl get_param -n lov.*.qos_prio_free @@ -4360,7 +4372,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 @@ -4395,7 +4407,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 @@ -4437,7 +4449,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 @@ -4541,7 +4553,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 @@ -4575,7 +4587,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 @@ -4613,7 +4625,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 @@ -4649,7 +4661,7 @@ run_test 118j "Simulate unrecoverable OST side error ==========" test_118k() { - remote_ost_nodsh && skip "remote OSTs" && return + remote_ost_nodsh && skip "remote OSTs with nodsh" && return #define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e set_nodes_failloc "$(osts_nodes)" 0x20e @@ -5212,7 +5224,7 @@ run_test 128 "interactive lfs for 2 consecutive finds" test_129() { [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0 - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return DEV=$(basename $(do_facet mds lctl get_param -n mds.*.mntdev)) [ -z "$DEV" ] && error "can't access mds mntdev" @@ -5616,7 +5628,7 @@ check_file_in_pool() test_200a() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + 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-mdtlov.pools.$POOL [ $? == 0 ] || error "Pool creation of $POOL failed" @@ -5626,7 +5638,7 @@ run_test 200a "Create new pool ==========================================" test_200b() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + 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 \ @@ -5640,7 +5652,7 @@ run_test 200b "Add targets to a pool ====================================" test_200c() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + 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" @@ -5650,7 +5662,7 @@ run_test 200c "Set pool on a directory =================================" test_200d() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + 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" } @@ -5659,7 +5671,7 @@ run_test 200d "Check pool on a directory ===============================" test_200e() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return failed=0 for i in $(seq -w 1 $(($TGT_COUNT * 3))); do file=$POOL_DIR/file-$i @@ -5676,7 +5688,7 @@ run_test 200e "Check files allocation from directory pool ==============" test_200f() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $POOL_FILE failed=0 for i in $(seq -w 1 $(($TGT_COUNT * 3))); do @@ -5694,7 +5706,7 @@ run_test 200f "Create files in a pool ===================================" test_200g() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return TGT=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL | head -1) do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT @@ -5707,7 +5719,7 @@ run_test 200g "Remove a target from a pool =============================" test_200h() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return for TGT in $(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL); do do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT done @@ -5719,7 +5731,7 @@ run_test 200h "Remove all targets from a pool ==========================" test_200i() { [ -z "$(lctl get_param -n mdc.*.connect_flags | grep pools)" ] && skip "missing pools support on server" && return - remote_mds_nodsh && skip "remote MDS" && return + 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-mdtlov.pools.$POOL 2>/dev/null") [ "$res" = "" ] || error "Pool $FSNAME.$POOL is not destroyed" -- 1.8.3.1