From 062ecdedbd1d816cf75ed8e2b356f5aa34e03fa2 Mon Sep 17 00:00:00 2001 From: Elena Gryaznova Date: Tue, 20 Jul 2010 17:54:43 +0400 Subject: [PATCH] b=22402 new OBDFILTER_SURVEY test suite i=Andrew.Perepechko --- lustre/tests/Makefile.am | 2 +- lustre/tests/acceptance-small.sh | 2 +- lustre/tests/obdfilter-survey.sh | 101 +++++++++++++++++++++++++++++++++++++++ lustre/tests/test-framework.sh | 11 +++++ 4 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 lustre/tests/obdfilter-survey.sh diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index 10145ad..1c840f8 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -24,7 +24,7 @@ noinst_SCRIPTS += recovery-mds-scale.sh run_dd.sh run_tar.sh run_iozone.sh noinst_SCRIPTS += run_dbench.sh run_IOR.sh recovery-double-scale.sh noinst_SCRIPTS += recovery-random-scale.sh parallel-scale.sh metadata-updates.sh noinst_SCRIPTS += lustre-rsync-test.sh ost-pools.sh rpc.sh yaml.sh liblustre.sh -noinst_SCRIPTS += lnet-selftest.sh mmp.sh +noinst_SCRIPTS += lnet-selftest.sh obdfilter-survey.sh mmp.sh nobase_noinst_SCRIPTS = cfg/local.sh nobase_noinst_SCRIPTS += acl/make-tree acl/run cfg/ncli.sh nobase_noinst_SCRIPTS += racer/dir_create.sh racer/file_create.sh racer/file_list.sh diff --git a/lustre/tests/acceptance-small.sh b/lustre/tests/acceptance-small.sh index f92f3fa..3995d5c 100755 --- a/lustre/tests/acceptance-small.sh +++ b/lustre/tests/acceptance-small.sh @@ -14,7 +14,7 @@ DEFAULT_SUITES="runtests sanity sanity-benchmark sanityn lfsck liblustre sanity-gss performance-sanity large-scale recovery-mds-scale recovery-double-scale recovery-random-scale parallel-scale lustre_rsync-test metadata-updates ost-pools lnet-selftest - mmp" + mmp obdfilter-survey" if [[ -n $@ ]]; then ACC_SM_ONLY="${ACC_SM_ONLY} $@" diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh new file mode 100644 index 0000000..8bfaeae --- /dev/null +++ b/lustre/tests/obdfilter-survey.sh @@ -0,0 +1,101 @@ +#!/bin/bash +#set -x +set -e + +LUSTRE=${LUSTRE:-`dirname $0`/..} +. $LUSTRE/tests/test-framework.sh +init_test_env $@ + +nobjhi=${nobjhi:-1} +thrhi=${thrhi:-16} +size=${size:-1024} + +# the summary file a bit smaller than OSTSIZE +. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} + +[ "$SLOW" = no ] && { nobjhi=1; thrhi=4; } + +# Skip these tests +ALWAYS_EXCEPT="$OBDFILTER_SURVEY_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 + size=$((minsize * 10 / 1024 / 12 )) + echo min kbytesavail: $minsize using size=${size} MBytes per obd instance +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 + + echo $targets +} + +test_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" + echo + $cmd + eval $cmd + + cat ${TMP}/obdfilter_survey* +} +run_test 1 "Object Storage Targets survey" + +test_2 () { + rm -f ${TMP}/obdfilter_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 + + cat ${TMP}/obdfilter_survey* +} +run_test 2 "Stripe F/S over the Network" + +# README.obdfilter-survey: In network test only automated run is supported. +test_3 () { + remote_servers || { skip "Local servers" && return 0; } + + + 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* + setupall +} +run_test 3 "Network survey" + +equals_msg `basename $0`: test complete, cleaning up +cleanup_echo_devs +check_and_cleanup_lustre +[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index d7beffe..4947d7d 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1676,10 +1676,21 @@ stopall() { return 0 } +cleanup_echo_devs () { + local devs=$($LCTL dl | grep echo | awk '{print $4}') + + for dev in $devs; do + $LCTL --device $dev cleanup + $LCTL --device $dev detach + done +} + cleanupall() { nfs_client_mode && return stopall $* + cleanup_echo_devs + unload_modules cleanup_gss } -- 1.8.3.1