X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Ftest-framework.sh;h=0292bc2dc3ddc9b6883ec5432e3205bc1404b03a;hp=5bcd5ba853f0ff4475b4bc0d72bb4a1a5ac48856;hb=8ce48257490f20ec7f11929a42ab3891139a9d8c;hpb=17e28a2c8d8c03ca8640f3595f9f7c53d76c59da diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 5bcd5ba..0292bc2 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -514,6 +514,7 @@ load_modules_local() { load_module ../ldiskfs/ldiskfs load_module osd-ldiskfs/osd_ldiskfs fi + load_module nodemap/nodemap load_module mgs/mgs load_module mdd/mdd load_module mdt/mdt @@ -2613,7 +2614,11 @@ facet_host() { varname=${facet}_HOST if [ -z "${!varname}" ]; then if [ "${facet:0:3}" == "ost" ]; then - eval export ${facet}_HOST=${ost_HOST} + local fh=${facet%failover}_HOST + eval export ${facet}_HOST=${!fh} + if [ -z "${!varname}" ]; then + eval export ${facet}_HOST=${ost_HOST} + fi elif [ "${facet:0:3}" == "mdt" -o \ "${facet:0:3}" == "mds" -o \ "${facet:0:3}" == "mgs" ]; then @@ -3244,6 +3249,12 @@ mkfs_opts() { opts+=${L_GETIDENTITY:+" --param=mdt.identity_upcall=$L_GETIDENTITY"} if [ $fstype == ldiskfs ]; then + # Check for wide striping + if [ $OSTCOUNT -gt 160 ]; then + MDSJOURNALSIZE=${MDSJOURNALSIZE:-4096} + fs_mkfs_opts+="-O large_xattr" + fi + fs_mkfs_opts+=${MDSJOURNALSIZE:+" -J size=$MDSJOURNALSIZE"} if [ ! -z $EJOURNAL ]; then fs_mkfs_opts+=${MDSJOURNALSIZE:+" device=$EJOURNAL"} @@ -3839,10 +3850,10 @@ restore_mount () { } cleanup_mount () { - local clients=${CLIENTS:-$HOSTNAME} - local mntpt=$1 + local clients=${CLIENTS:-$HOSTNAME} + local mntpt=$1 - zconf_umount_clients $clients $mntpt + zconf_umount_clients $clients $mntpt } cleanup_and_setup_lustre() { @@ -3866,8 +3877,7 @@ get_mnt_devs() { if [ "$type" == ost ]; then devs=$(get_osd_param $node "" mntdev) else - devs=$(do_node $node \ - "lctl get_param -n osd-*.$FSNAME-M*.mntdev") + devs=$(do_node $node $LCTL get_param -n osd-*.$FSNAME-M*.mntdev) fi for dev in $devs; do case $dev in @@ -3880,33 +3890,56 @@ get_mnt_devs() { # Get all of the server target devices. get_svr_devs() { - local i + local node + local i - # MDT device - MDTDEV=$(get_mnt_devs $(mdts_nodes) mdt) + # Master MDS parameters used by lfsck + MDTNODE=$(facet_active_host $SINGLEMDS) + MDTDEV=$(echo $(get_mnt_devs $MDTNODE mdt) | awk '{print $1}') - # OST devices - i=0 - for node in $(osts_nodes); do - OSTDEVS[i]=$(get_mnt_devs $node ost) - i=$((i + 1)) - done + # MDT devices + i=0 + for node in $(mdts_nodes); do + MDTDEVS[i]=$(get_mnt_devs $node mdt) + i=$((i + 1)) + done + + # OST devices + i=0 + for node in $(osts_nodes); do + OSTDEVS[i]=$(get_mnt_devs $node ost) + i=$((i + 1)) + done } # Run e2fsck on MDT or OST device. run_e2fsck() { - local node=$1 - local target_dev=$2 - local extra_opts=$3 + local node=$1 + local target_dev=$2 + local extra_opts=$3 + local cmd="$E2FSCK -d -v -t -t -f $extra_opts $target_dev" + local log=$TMP/e2fsck.log + local rc=0 - df > /dev/null # update statfs data on disk - local cmd="$E2FSCK -d -v -t -t -f $extra_opts $target_dev" - echo $cmd - local rc=0 - do_node $node $cmd || rc=$? - [ $rc -le $FSCK_MAX_ERR ] || \ - error "$cmd returned $rc, should be <= $FSCK_MAX_ERR" - return 0 + echo $cmd + do_node $node $cmd 2>&1 | tee $log + rc=${PIPESTATUS[0]} + if [ -n "$(grep "DNE mode isn't supported" $log)" ]; then + rm -f $log + if [ $MDSCOUNT -gt 1 ]; then + skip "DNE mode isn't supported!" + cleanupall + exit_status + else + error "It's not DNE mode." + fi + fi + rm -f $log + + [ $rc -le $FSCK_MAX_ERR ] || + error "$cmd returned $rc, should be <= $FSCK_MAX_ERR" + + return 0 } # @@ -3935,22 +3968,23 @@ check_shared_dir() { # Run e2fsck on MDT and OST(s) to generate databases used for lfsck. generate_db() { - local i - local ostidx - local dev + local i + local ostidx + local dev + local node [[ $(lustre_version_code $SINGLEMDS) -ne $(version_code 2.2.0) ]] || { skip "Lustre 2.2.0 lacks the patch for LU-1255"; exit 0; } - check_shared_dir $SHARED_DIRECTORY || - error "$SHARED_DIRECTORY isn't a shared directory" - - export MDSDB=$SHARED_DIRECTORY/mdsdb - export OSTDB=$SHARED_DIRECTORY/ostdb + check_shared_dir $SHARED_DIRECTORY || + error "$SHARED_DIRECTORY isn't a shared directory" - [ $MDSCOUNT -eq 1 ] || error "CMD is not supported" + export MDSDB=$SHARED_DIRECTORY/mdsdb + export OSTDB=$SHARED_DIRECTORY/ostdb - run_e2fsck $(mdts_nodes) $MDTDEV "-n --mdsdb $MDSDB" + # DNE is not supported, so when running e2fsck on a DNE filesystem, + # we only pass master MDS parameters. + run_e2fsck $MDTNODE $MDTDEV "-n --mdsdb $MDSDB" i=0 ostidx=0 @@ -3980,7 +4014,7 @@ run_lfsck_remote() { fi #Run lfsck echo $cmd - do_node $node $cmd || rc=$? + do_node $client $cmd || rc=$? #Umount if necessary if ! $mounted; then zconf_umount $client $MOUNT || @@ -4499,10 +4533,16 @@ skip() { build_test_filter() { EXCEPT="$EXCEPT $(testslist_filter)" - [ "$ONLY" ] && log "only running test `echo $ONLY`" - for O in $ONLY; do - eval ONLY_${O}=true - done + for O in $ONLY; do + if [[ $O = [0-9]*-[0-9]* ]]; then + for num in $(seq $(echo $O | tr '-' ' ')); do + eval ONLY_$num=true + done + else + eval ONLY_${O}=true + fi + done + [ "$EXCEPT$ALWAYS_EXCEPT" ] && \ log "excepting tests: `echo $EXCEPT $ALWAYS_EXCEPT`" [ "$EXCEPT_SLOW" ] && \ @@ -4678,34 +4718,35 @@ banner() { } # -# Run a single test function and cleanup after it. +# Run a single test function and cleanup after it. # # This function should be run in a subshell so the test func can # exit() without stopping the whole script. # run_one() { - local testnum=$1 - local message=$2 - tfile=f.${TESTSUITE}.${testnum} - export tdir=d0.${TESTSUITE}/d${base} - export TESTNAME=test_$testnum - local SAVE_UMASK=`umask` - umask 0022 - - banner "test $testnum: $message" - test_${testnum} || error "test_$testnum failed with $?" - cd $SAVE_PWD - reset_fail_loc - check_grant ${testnum} || error "check_grant $testnum failed with $?" - check_catastrophe || error "LBUG/LASSERT detected" + local testnum=$1 + local message=$2 + export tfile=f${testnum}.${TESTSUITE} + export tdir=d${testnum}.${TESTSUITE} + export TESTNAME=test_$testnum + local SAVE_UMASK=`umask` + umask 0022 + + banner "test $testnum: $message" + test_${testnum} || error "test_$testnum failed with $?" + cd $SAVE_PWD + reset_fail_loc + check_grant ${testnum} || error "check_grant $testnum failed with $?" + check_catastrophe || error "LBUG/LASSERT detected" if [ "$PARALLEL" != "yes" ]; then ps auxww | grep -v grep | grep -q multiop && error "multiop still running" fi - unset TESTNAME - unset tdir - umask $SAVE_UMASK - return 0 + unset TESTNAME + unset tdir + unset tfile + umask $SAVE_UMASK + return 0 } # @@ -4745,6 +4786,10 @@ run_one_logged() { fi log_sub_test_end $TEST_STATUS $duration "$RC" "$TEST_ERROR" + if [[ "$TEST_STATUS" != "SKIP" ]] && [[ -f $TF_SKIP ]]; then + rm -f $TF_SKIP + fi + if [ -f $LOGDIR/err ]; then $FAIL_ON_ERROR && exit $RC fi @@ -5612,39 +5657,34 @@ request_timeout () { } _wait_osc_import_state() { - local facet=$1 - local ost_facet=$2 - local expected=$3 - local ost=$(get_osc_import_name $facet $ost_facet) - + local facet=$1 + local ost_facet=$2 + local expected=$3 + local ost=$(get_osc_import_name $facet $ost_facet) local param="osc.${ost}.ost_server_uuid" + local params=$param local i=0 - # 1. wait the deadline of client 1st request (it could be skipped) - # 2. wait the deadline of client 2nd request - local maxtime=$(( 2 * $(request_timeout $facet))) - - #During setup time, the osc might not be setup, it need wait - #until list_param can return valid value. And also if there - #are mulitple osc entries we should list all of them before - #go to wait. - local params=$($LCTL list_param $param 2>/dev/null || true) - while [ -z "$params" ]; do - if [ $i -ge $maxtime ]; then - echo "can't get $param by list_param in $maxtime secs" - if [[ $facet != client* ]]; then - echo "Go with $param directly" - params=$param - break - else + # 1. wait the deadline of client 1st request (it could be skipped) + # 2. wait the deadline of client 2nd request + local maxtime=$(( 2 * $(request_timeout $facet))) + + if [[ $facet == client* ]]; then + # During setup time, the osc might not be setup, it need wait + # until list_param can return valid value. And also if there + # are mulitple osc entries we should list all of them before + # go to wait. + params=$($LCTL list_param $param 2>/dev/null || true) + while [ -z "$params" ]; do + if [ $i -ge $maxtime ]; then + echo "can't get $param in $maxtime secs" return 1 fi - fi - sleep 1 - i=$((i + 1)) - params=$($LCTL list_param $param 2>/dev/null || true) - done - + sleep 1 + i=$((i + 1)) + params=$($LCTL list_param $param 2>/dev/null || true) + done + fi if ! do_rpc_nodes "$(facet_active_host $facet)" \ wait_import_state $expected "$params" $maxtime; then error "import is not in ${expected} state"