From 09478ef1c43939bfb26de1bf2f9dad8766b979ab Mon Sep 17 00:00:00 2001 From: James Nunez Date: Wed, 27 Jun 2018 11:00:22 -0600 Subject: [PATCH] LU-9268 tests: check obj distribution for PFL striping Add test to sanity-pfl to verfy that new components are distributed evenly among OSTs for composite files. Test-Parameters: trivial osscount=3 ostcount=4 testlist=sanity-pfl Signed-off-by: Alex Zhuravlev Signed-off-by: James Nunez Change-Id: I0335fd376f6008529885236faad19a29eb01d5ba Reviewed-on: https://review.whamcloud.com/26863 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/tests/sanity-pfl.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/lustre/tests/sanity-pfl.sh b/lustre/tests/sanity-pfl.sh index 679a0dd..e27c39e 100644 --- a/lustre/tests/sanity-pfl.sh +++ b/lustre/tests/sanity-pfl.sh @@ -748,6 +748,80 @@ test_17() { } run_test 17 "Verify LOVEA grows with more component inited" +check_distribution() { + local file=$1 + local objs + local ave + local obj_min_one=$((OSTCOUNT - 1)) + + objs=$($LFS getstripe $file | + awk '/l_ost_idx:/ { print $5 }' | wc -l) + let ave=$((objs / OSTCOUNT)) + + # collect objects per OST distribution + $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," | + (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) ) + while read O; do + let inuse[$O]=$((1 + ${inuse[$O]})) + done; + + # verify object distribution varies no more than +-1 + for idx in $(seq 0 $obj_min_one); do + let dif=$((${inuse[$idx]} - ave)) + let dif=${dif#-} + if [ "$dif" -gt 1 ]; then + echo "OST${idx}: ${inuse[$idx]} objects" + error "bad distribution on OST${idx}" + fi + done) +} + +test_18() { + local file1=$DIR/${tfile}-1 + local file2=$DIR/${tfile}-2 + local file3=$DIR/${tfile}-3 + + rm -f $file1 $file2 $file3 + + $LFS setstripe -E 1m -S 1m $file1 || + error "Create $file1 failed" + $LFS setstripe -E 1m -S 1m $file2 || + error "Create $file2 failed" + $LFS setstripe -E 1m -S 1m $file3 || + error "Create $file3 failed" + + local objs=$((OSTCOUNT+1)) + for comp in $(seq 1 $OSTCOUNT); do + $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 || + error "Add component to $file1 failed 2" + $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 || + error "Add component to $file2 failed 2" + $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 || + error "Add component to $file3 failed 2" + done + + $LFS setstripe --component-add -E -1 -c -1 $file1 || + error "Add component to $file1 failed 3" + $LFS setstripe --component-add -E -1 -c -1 $file2 || + error "Add component to $file2 failed 3" + $LFS setstripe --component-add -E -1 -c -1 $file3 || + error "Add component to $file3 failed 3" + + # Instantiate all components + dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) || + error "dd failed for $file1" + dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) || + error "dd failed for $file2" + dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) || + error "dd failed for $file3" + + check_distribution $file1 + check_distribution $file2 + check_distribution $file3 + +} +run_test 18 "check component distribution" + complete $SECONDS check_and_cleanup_lustre exit_status -- 1.8.3.1