From bd9ca13da46a4bba4bcb7471d5bef5e63338d0e0 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Tue, 14 Jan 2014 17:03:00 +0800 Subject: [PATCH] LU-3189 tests: add version check code into sanity test 53 This patch adds Lustre version check codes into sanity test 53 to make the test work with servers that do not have the following patch: Lustre-commit: 6c4c51e3079e6c257fbf86536e4739110c166e3b Lustre-change: http://review.whamcloud.com/4789 Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes,ONLY=53 \ ossjob=lustre-b2_3 mdsjob=lustre-b2_3 ossbuildno=41 mdsbuildno=41 \ testlist=sanity Signed-off-by: Jian Yu Change-Id: Ie6eaeee31780f4ea4077805f52efda279ff96670 Reviewed-on: http://review.whamcloud.com/8834 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 62 +++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 421fc14..4c75942 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3874,37 +3874,53 @@ test_53() { local ost_last_id local ostnum local node - local found=0 + local found=false + local support_last_seq=true + + [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.60) ]] || + support_last_seq=false # only test MDT0000 - local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS) - for value in $(do_facet $SINGLEMDS lctl get_param osc.$mdtosc.prealloc_last_id) ; do - param=$(echo ${value[0]} | cut -d "=" -f1) - ostname=$(echo $param | cut -d "." -f2 | cut -d - -f 1-2) - param_seq=$(echo ${param} | - sed -e s/prealloc_last_id/prealloc_last_seq/g) - mds_last_seq=$(do_facet $SINGLEMDS lctl get_param -n $param_seq) - mds_last=$(do_facet $SINGLEMDS lctl get_param -n $param) + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS) + local value + for value in $(do_facet $SINGLEMDS \ + $LCTL get_param osc.$mdtosc.prealloc_last_id) ; do + param=$(echo ${value[0]} | cut -d "=" -f1) + ostname=$(echo $param | cut -d "." -f2 | cut -d - -f 1-2) + + if $support_last_seq; then + param_seq=$(echo $param | + sed -e s/prealloc_last_id/prealloc_last_seq/g) + mds_last_seq=$(do_facet $SINGLEMDS \ + $LCTL get_param -n $param_seq) + fi + mds_last=$(do_facet $SINGLEMDS $LCTL get_param -n $param) ostnum=$(index_from_ostuuid ${ostname}_UUID) node=$(facet_active_host ost$((ostnum+1))) param="obdfilter.$ostname.last_id" - for ost_last in $(do_node $node lctl get_param -n $param) ; do - echo "$ostname.last_id=$ost_last ;MDS.last_id=$mds_last" - ost_last_id=$(echo $ost_last | awk -F':' '{print $2}' | - sed -e "s/^0x//g") - ost_last_seq=$(echo $ost_last | awk -F':' '{print $1}') - if [ $ost_last_seq = $mds_last_seq ]; then - if [ $ost_last_id != $mds_last ]; then - error "$ost_last != $mds_last_id" - else - found=1 - break - fi + for ost_last in $(do_node $node $LCTL get_param -n $param) ; do + echo "$ostname.last_id=$ost_last; MDS.last_id=$mds_last" + ost_last_id=$ost_last + + if $support_last_seq; then + ost_last_id=$(echo $ost_last | + awk -F':' '{print $2}' | + sed -e "s/^0x//g") + ost_last_seq=$(echo $ost_last | + awk -F':' '{print $1}') + [[ $ost_last_seq = $mds_last_seq ]] || continue + fi + + if [[ $ost_last_id != $mds_last ]]; then + error "$ost_last_id != $mds_last" + else + found=true + break fi done - done - [ $found = 0 ] && error "can not match last_seq/last_id for $mdtosc" + done + $found || error "can not match last_seq/last_id for $mdtosc" return 0 } run_test 53 "verify that MDS and OSTs agree on pre-creation ====" -- 1.8.3.1