X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fobdfilter-survey.sh;h=890f0e4306580ba75c3992490dc9455b9836ca9d;hb=ff35e27da4c76bc93c7641ef54d425d77e821e9f;hp=8bfaeaef05c3480a4bb24c8204b72ed9ffa87026;hpb=062ecdedbd1d816cf75ed8e2b356f5aa34e03fa2;p=fs%2Flustre-release.git diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index 8bfaeae..890f0e4 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -1,32 +1,27 @@ #!/bin/bash -#set -x set -e -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ +init_logging -nobjhi=${nobjhi:-1} -thrhi=${thrhi:-16} -size=${size:-1024} +# bug number for skipped test: +ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT " +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! -# the summary file a bit smaller than OSTSIZE -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} +build_test_filter [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; } - -# Skip these tests -ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT" +nobjhi=${nobjhi:-1} +thrhi=${thrhi:-16} +size=${size:-1024} +thrlo=${thrlo:-$(( thrhi / 2))} OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)} -build_test_filter check_and_setup_lustre -min_ost_size () { - $LCTL get_param -n osc.*.kbytesavail | sort -n | head -n1 -} - # FIXME: the summary file a bit smaller than OSTSIZE, add estimation minsize=$(min_ost_size) if [ $(( size * 1024 )) -ge $minsize ]; then @@ -35,67 +30,141 @@ if [ $(( size * 1024 )) -ge $minsize ]; then fi get_targets () { - local targets - local devs - local oss - - for oss in $(osts_nodes); do - devs=$(do_node $oss "lctl dl |grep obdfilter |sort" | awk '{print $4}') - for d in $devs; do - # if oss is local -- obdfilter-survey needs dev wo/ host - target=$d - [[ $oss = `hostname` ]] || target=$oss:$target - targets="$targets $target" - done - done + local targets + local target + local dev + local nid + local osc + + for osc in $($LCTL get_param -N osc.${FSNAME}-*osc-*); do + nid=$($LCTL get_param $osc.import | + awk '/current_connection:/ {sub(/@.*/,""); print $2}') + dev=$(echo $osc | sed -e 's/^osc\.//' -e 's/-osc.*//') + target=$dev + + # For local disk obdfilter-survey requires target devs w/o nid. + # obdfilter-survey : + # case 1 (local disk): + # $ nobjhi=2 thrhi=2 size=1024 + # targets="$nid:$FSNAME-OST0000 $nid:$FSNAME-OST0001 ..." + # sh obdfilter-survey + local_node && [ "$1" == "disk" ] || target=$nid:$target + targets="$targets $target" + done + echo $targets +} + +obdflter_survey_targets () { + local case=$1 + local targets + case $case in + disk) targets=$(get_targets $case);; + netdisk) targets=$(get_targets $case);; + network) targets=$(host_nids_address $(comma_list $(osts_nodes)) $NETTYPE);; + *) error "unknown obdflter-survey case!" ;; + esac echo $targets } -test_1 () { +obdflter_survey_run () { + local case=$1 + rm -f ${TMP}/obdfilter_survey* - local targets=$(get_targets) - local cmd="nobjhi=$nobjhi thrhi=$thrhi size=$size case=disk rslt_loc=${TMP} targets=\"$targets\" sh $OBDSURVEY" + local targets=$(obdflter_survey_targets $case) + local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY" echo + $cmd eval $cmd + local rc=$? cat ${TMP}/obdfilter_survey* + [ $rc = 0 ] || error "$OBDSURVEY failed: $rc" } -run_test 1 "Object Storage Targets survey" -test_2 () { - rm -f ${TMP}/obdfilter_survey* +test_1a () { + obdflter_survey_run disk +} +run_test 1a "Object Storage Targets survey" - local targets=$(get_targets) - local cmd="nobjhi=$nobjhi thrhi=$thrhi size=$size rslt_loc=${TMP} case=netdisk targets=\"$targets\" sh $OBDSURVEY" - echo + $cmd - eval $cmd +test_1b () { + local param_file=$TMP/$tfile-params - cat ${TMP}/obdfilter_survey* + do_nodesv $(comma_list $(osts_nodes)) \ + $LCTL get_param obdfilter.${FSNAME}-*.sync_journal + save_lustre_params $(get_facets OST) \ + "obdfilter.${FSNAME}-*.sync_journal" > $param_file + do_nodesv $(comma_list $(osts_nodes)) \ + $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0 + + local stime=$(date +%s) + thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run disk + local etime=$(date +%s) + # run time of obd survey + local rtime=$((etime - stime)) + + echo "obd survey finished in $rtime seconds" + restore_lustre_params < $param_file + + rm -f $param_file +} +run_test 1b "Object Storage Targets survey, async journal" + +test_1c () { + nobjlo=1 nobjhi=1 thrlo=32 thrhi=32 rszlo=1024 rszhi=1024 size=8192\ + obdflter_survey_run disk +} +run_test 1c "Object Storage Targets survey, big batch" + +test_2a () { + obdflter_survey_run netdisk +} +run_test 2a "Stripe F/S over the Network" + +test_2b () { + local param_file=$TMP/$tfile-params + + do_nodesv $(comma_list $(osts_nodes)) \ + $LCTL get_param obdfilter.${FSNAME}-*.sync_journal + save_lustre_params $(get_facets OST) \ + "obdfilter.${FSNAME}-*.sync_journal" > $param_file + do_nodesv $(comma_list $(osts_nodes)) \ + $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0 + + local stime=$(date +%s) + thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run netdisk + local etime=$(date +%s) + local rtime=$((etime - stime)) + + echo "obd survey finished in $rtime seconds" + restore_lustre_params < $param_file + + rm -f $param_file } -run_test 2 "Stripe F/S over the Network" +run_test 2b "Stripe F/S over the Network, async journal" + # README.obdfilter-survey: In network test only automated run is supported. -test_3 () { - remote_servers || { skip "Local servers" && return 0; } +test_3a () { + # obdfilter-survey Prerequisite: + # For "network" case you need to have all + # modules (those llmount.sh loads) loaded in kernel. And the + # 'lctl dl' output must be blank. + # Skipping test for CLIENTONLY mode because of + # cleanupall()->stopall() does not cleanup the servers on this mode. + [ "$CLIENTONLY" ] && skip "CLIENTONLY mode" + remote_servers || skip "Local servers" - rm -f ${TMP}/obdfilter_survey* - # The Network survey test needs: - # Start lctl and check for the device list. The device list must be empty. cleanupall - - local cmd="nobjhi=2 thrhi=4 size=$size targets="$(osts_nodes)" case=network sh $OBDSURVEY" - echo + $cmd - eval $cmd - cat ${TMP}/obdfilter_survey* + obdflter_survey_run network + setupall } -run_test 3 "Network survey" +run_test 3a "Network survey" -equals_msg `basename $0`: test complete, cleaning up +complete $SECONDS cleanup_echo_devs check_and_cleanup_lustre -[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true +exit_status