X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fmds-survey.sh;h=93715b25ab1b8a57e1de4879b4014862a4cbb272;hb=00141b1a746d4733c2f52c7a7edec36da4cedcac;hp=26987c2d23815b7be56f15880b92d53e7291efb2;hpb=1bf858d5e1985aabafb90f4a011b737f95504b67;p=fs%2Flustre-release.git diff --git a/lustre/tests/mds-survey.sh b/lustre/tests/mds-survey.sh index 26987c2..93715b2 100644 --- a/lustre/tests/mds-survey.sh +++ b/lustre/tests/mds-survey.sh @@ -1,15 +1,21 @@ #!/bin/bash -#set -x set -e -LUSTRE=${LUSTRE:-`dirname $0`/..} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging +ALWAYS_EXCEPT="$MDS_SURVEY_EXCEPT " + build_test_filter -check_and_setup_lustre + +MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)} +[ -z ${MDSSURVEY} ] && skip_env "mds-survey not found" + +if [ "$MDS1_VERSION" -lt $(version_code 2.3.51) ]; then + skip "Need MDS version at least 2.3.51" +fi file_count=${file_count:-150000} dir_count=${dir_count:-4} @@ -18,13 +24,7 @@ thrlo=${thrlo:-1} [ "$SLOW" = no ] && { file_count=50000; dir_count=2; thrhi=4; } -# Skip these tests -ALWAYS_EXCEPT="$MDS_SURVEY_EXCEPT" - -MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)} -if [ -z ${MDSSURVEY} ]; then - skip_env "mds-survey not found" && exit -fi +check_and_setup_lustre adjust_inode() { local require_inode=0 @@ -33,8 +33,7 @@ adjust_inode() { require_inode=$((file_count * thrhi)) # get available inode for mdt - avail_mdt_inode=$($LFS df -i $MOUNT | grep "filesystem summary:" | \ - awk '{print $5}') + avail_mdt_inode=$(mdt_free_inodes 0) avail_mdt_inode=$((avail_mdt_inode * 9 / 10)) # get available inode for ost @@ -64,48 +63,71 @@ cleanup_mount $MOUNT cleanup_mount $MOUNT2 get_target() { - local mds=$(facet_host $SINGLEMDS) - echo $(do_nodes $mds 'lctl dl' | \ - awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}") + local node=$1 + local mdt + local mdts + local target + + mdts=$(do_node $node "$LCTL dl" | + awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}") + + for mdt in $mdts; do + target+="${target:+ }$node:$mdt" + done + + echo -n $target +} + +get_targets() { + local targets + local node + + for node in $(mdts_nodes); do + targets+="${targets:+ }$(get_target $node)" + done + + echo -n $targets } mds_survey_run() { - local layer=${1:-mdd} - local stripe_count=${2:-0} - local mds=$(facet_host $SINGLEMDS) - local rc=0 - - rm -f ${TMP}/mds_survey* - - local target=$(get_target) - local cmd="file_count=$file_count thrlo=$thrlo thrhi=$thrhi" - local cmd+=" dir_count=$dir_count layer=$layer stripe_count=$stripe_count" - local cmd+=" rslt_loc=${TMP} targets=\"$mds:$target\" $MDSSURVEY" - - echo + $cmd - eval $cmd || rc=$? - cat ${TMP}/mds_survey* - rm -f ${TMP}/mds_survey* - ((rc == 0)) || error "mds-survey failed" + local layer=${1:-mdd} + local stripe_count=${2:-0} + local rc=0 + + rm -f ${TMP}/mds_survey* + + local cmd="file_count=$file_count thrlo=$thrlo thrhi=$thrhi" + cmd+=" dir_count=$dir_count layer=$layer stripe_count=$stripe_count" + cmd+=" rslt_loc=${TMP} targets=\"$(get_targets)\" $MDSSURVEY" + + trap cleanup_echo_devs EXIT ERR + + echo + $cmd + eval $cmd || rc=$? + cat ${TMP}/mds_survey* + rm -f ${TMP}/mds_survey* + ((rc == 0)) || error "mds-survey failed" } test_1() { - mds_survey_run "mdd" "0" + mds_survey_run "mdd" "0" } run_test 1 "Metadata survey with zero-stripe" test_2() { - if [ $ost_count -eq 0 ]; then - skip_env "Need to mount OST to test" && return - fi - mds_survey_run "mdd" "1" + local mdscount=$(get_node_count "$(mdts_nodes)") + + [ $mdscount -gt 1 ] && skip_env "Only run this test on single MDS" + [ $ost_count -eq 0 ] && skip_env "Need to mount OST to test" + + mds_survey_run "mdd" "1" } run_test 2 "Metadata survey with stripe_count = 1" # remount the clients restore_mount $MOUNT -complete $(basename $0) $SECONDS +complete $SECONDS cleanup_echo_devs check_and_cleanup_lustre exit_status