X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fobdfilter-survey.sh;h=bf5189af7ede144b2809e771df90328da1e7d1f1;hb=76ca884398cae59e455caf3ae2ab1609c5fb1eea;hp=f5cd00db0e0b7db9f8a1232228063ce8e6c28e6a;hpb=8c4f96f910786ff3d73474ef5f8d4a96a30a0bed;p=fs%2Flustre-release.git diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index f5cd00d..bf5189a 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -12,23 +12,20 @@ size=${size:-1024} # the summary file a bit smaller than OSTSIZE . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} +init_logging [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; } thrlo=${thrlo:-$(( thrhi / 2))} -# Skip these tests -# bug number 23791 23791 -ALWAYS_EXCEPT="1b 2b $OBDFILTER_SURVEY_EXCEPT" +# bug number for skipped test: +ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT" +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! 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 @@ -37,20 +34,27 @@ 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="lustre-OST0000 lustre-OST0001 ..." + # sh obdfilter-survey + local_node && [ "$1" == "disk" ] || target=$nid:$target + targets="$targets $target" + done echo $targets } @@ -59,9 +63,9 @@ obdflter_survey_targets () { local targets case $case in - disk) targets=$(get_targets);; - netdisk) targets=$(get_targets);; - network) targets="$(osts_nodes)";; + 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 @@ -76,78 +80,46 @@ obdflter_survey_run () { 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" } + test_1a () { obdflter_survey_run disk } run_test 1a "Object Storage Targets survey" -print_jbd () { - local file=$1 - local facet=$2 - local varsvc=${facet}_svc - local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet) - - # ext4: /proc/fs/jbd2/sda1:8/history - # ext3: /proc/fs/jbd/sdb1/history - - do_facet $facet cat /proc/fs/jbd*/${dev}*/$file -} - -check_jbd_values () { - local facet=$1 - local thrhi=$2 - - # last two lines from history - # $4: run >= 5000 - # $8: hndls >= thrhi * 2 - local hist=("$(print_jbd history $facet | tail -3 | head -2)") - echo "$hist" - local run=($(echo "${hist[*]}" | awk '{print $4}')) - local hndls=($(echo "${hist[*]}" | awk '{print $8}')) - - local rc=0 - for (( i=0; i<1; i++)); do - [[ ${run[i]} -lt 5000 ]] && \ - error "$facet: run expected 5000, have ${run[i]}" && rc=1 - [[ ${hndls[i]} -lt $((thrhi * 2)) ]] && \ - error "$facet: hndls expected > $((thrhi * 2)), have ${hndls[i]}" && rc=2 - done - return $rc -} - -check_jbd_values_facets () { - local facets=$1 - local thrhi=$2 - local facet - local rc=0 - for facet in ${facets//,/ }; do - check_jbd_values $facet $thrhi || rc=$((rc+$?)) - done - return $rc -} - test_1b () { local param_file=$TMP/$tfile-params - do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal - - save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file - do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0 + 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)) - check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?)) - + echo "obd survey finished in $rtime seconds" restore_lustre_params < $param_file rm -f $param_file - return $rc } 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 } @@ -156,29 +128,38 @@ 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 $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file - do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0 + 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)) - check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?)) - + echo "obd survey finished in $rtime seconds" restore_lustre_params < $param_file rm -f $param_file - return $rc } run_test 2b "Stripe F/S over the Network, async journal" # README.obdfilter-survey: In network test only automated run is supported. test_3a () { - remote_servers || { skip "Local servers" && return 0; } + # 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" - # The Network survey test needs: - # Start lctl and check for the device list. The device list must be empty. cleanupall obdflter_survey_run network @@ -187,7 +168,7 @@ test_3a () { } run_test 3a "Network survey" -complete $(basename $0) $SECONDS +complete $SECONDS cleanup_echo_devs check_and_cleanup_lustre exit_status