From: Jian Yu Date: Tue, 29 Oct 2013 13:45:21 +0000 (+0800) Subject: LU-4175 tests: fix obdecho_test() to calculate write count X-Git-Tag: 2.5.52~6 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9b5755ec736de3c3a5a2622ba136fdd20a5cea91 LU-4175 tests: fix obdecho_test() to calculate write count This patch fixes obdecho_test() in sanity.sh to calculate write count so as to avoid out of space failure while the page number is large but the obd target size is small. Signed-off-by: Jian Yu Change-Id: Ibff44bf1f6a932e99c565eeda2f1edaf80962dbf Reviewed-on: http://review.whamcloud.com/8089 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 97fed43..2831fde 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9970,6 +9970,15 @@ obdecho_test() { local pages=${3:-64} local rc=0 local id + + local count=10 + local obd_size=$(get_obd_size $node $OBD) + local page_size=$(get_page_size $node) + if [[ -n "$obd_size" ]]; then + local new_count=$((obd_size / (pages * page_size / 1024))) + [[ $new_count -ge $count ]] || count=$new_count + fi + do_facet $node "$LCTL attach echo_client ec ec_uuid" || rc=1 [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec setup $OBD" || rc=2; } @@ -9981,7 +9990,7 @@ obdecho_test() { [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec getattr $id" || rc=4; } [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec " \ - "test_brw 10 w v $pages $id" || rc=4; } + "test_brw $count w v $pages $id" || rc=4; } [ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" || rc=4; } [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec " \ diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a807c6b..675e311 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -6442,6 +6442,32 @@ min_ost_size () { } # +# Get the available size (KB) of a given obd target. +# +get_obd_size() { + local facet=$1 + local obd=$2 + local size + + [[ $facet != client ]] || return 0 + + size=$(do_facet $facet $LCTL get_param -n *.$obd.kbytesavail | head -n1) + echo -n $size +} + +# +# Get the page size (bytes) on a given facet node. +# +get_page_size() { + local facet=$1 + local size + + size=$(do_facet $facet getconf PAGE_SIZE) + [[ ${PIPESTATUS[0]} = 0 && -n "$size" ]] || size=4096 + echo -n $size +} + +# # Get the block count of the filesystem. # get_block_count() {