From f3505077879562a61820edc2b12fe5fd46945c2c Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Mon, 1 Apr 2013 23:18:50 +0800 Subject: [PATCH] LU-2598 tests: add version check code to sanity test 180c This patch adds Lustre version check codes into sanity test 180c and obdfilter-survey to make the tests work with servers which do not have the patch of commit 25170d2. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes \ clientdistro=el6 serverdistro=el6 clientarch=x86_64 \ serverarch=x86_64 serverjob=lustre-b2_1 serverbuildno=164 \ testlist=sanity,obdfilter-survey Signed-off-by: Jian Yu Change-Id: Iad7dddf21b223d78efcc285b13b9381e5f0e0ccd Reviewed-on: http://review.whamcloud.com/5902 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam --- lustre-iokit/obdfilter-survey/obdfilter-survey | 32 ++++++++++++++++++++++++++ lustre/tests/sanity.sh | 22 +++++++++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/lustre-iokit/obdfilter-survey/obdfilter-survey b/lustre-iokit/obdfilter-survey/obdfilter-survey index 5f47175..c3c6fc0 100755 --- a/lustre-iokit/obdfilter-survey/obdfilter-survey +++ b/lustre-iokit/obdfilter-survey/obdfilter-survey @@ -56,6 +56,7 @@ size=${size:-16384} # record size (KBytes) ( 7168 max) rszlo=${rszlo:-1024} rszhi=${rszhi:-1024} +rszmax=${rszmax:-1024} # the maximum bulk I/O RPC size # number of objects per OST nobjlo=${nobjlo:-1} @@ -186,6 +187,32 @@ print_summary () { echo $minusn "$*" } +version_code() { + # split arguments like "2.1.5" into "2", "1", "5" + eval set -- $(tr "[:punct:]" " " <<< $*) + echo -n "$((($1 << 16) | ($2 << 8) | $3))" +} + +get_lustre_version() { + local host=${1:-${unique_hosts[0]}} + remote_shell $host $lctl get_param -n version | + awk '/^lustre:/ {print $2}' +} + +# Check whether the record size (KBytes) exceeds the maximum bulk I/O RPC size +# or not. +check_record_size() { + [ $(version_code $(get_lustre_version)) -ge $(version_code 2.3.61) ] && + rszmax=4096 + + if [ "$rszhi" -gt "$rszmax" ]; then + echo "Test disk case support maximum ${rszmax}KB IO data" \ + "(rszhi=$rszhi is too big), please use a smaller value." + return 1 + fi + return 0 +} + # Customisation variables ##################################################################### # One can change variable values in this section as per requirements @@ -372,6 +399,11 @@ fi # disable portals debug and get obdecho loaded on all relevant hosts unique_hosts=(`unique ${host_names[@]}`) load_obdechos + +if [ $case == "disk" ]; then + check_record_size || cleanup ${PIPESTATUS[0]} +fi + pidcount=0 for host in ${unique_hosts[@]}; do host_vmstatf=${vmstatf}_${host} diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e1a70f5..291f1488 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7907,6 +7907,16 @@ test_180b() { run_test 180b "test obdecho directly on obdfilter" test_180c() { # LU-2598 + local server_version=$(lustre_version_code $SINGLEMDS) + + [[ $server_version -lt $(version_code 2.1.5) ]] && + skip "Need MDS version at least 2.1.5" && return + + # Patch not applied to 2.2 and 2.3 branches + [[ $server_version -ge $(version_code 2.2.0) ]] && + [[ $server_version -lt $(version_code 2.4.0) ]] && + skip "Need MDS version at least 2.4.0" && return + local rc=0 local rmmod_remote=false local pages=8192 # 32MB bulk I/O RPC size @@ -7918,9 +7928,15 @@ test_180c() { # LU-2598 target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4}'|head -1) if [[ -n $target ]]; then obdecho_create_test "$target" ost1 "$pages" - if [[ ${PIPESTATUS[0]} != 4 ]]; then - echo "obecho_create_test should fail with rc=4" - rc=1 + rc=${PIPESTATUS[0]} + if [[ $server_version -ge $(version_code 2.1.5) ]] && + [[ $server_version -lt $(version_code 2.2.0) ]]; then + if [[ $rc -ne 4 ]]; then + echo "obecho_create_test should fail with rc=4" + rc=1 + else + rc=0 + fi fi else echo "there is no obdfilter target on ost1" -- 1.8.3.1