Whamcloud - gitweb
LU-3285 tests: add dom into racer test suite 31/29631/7
authorJinshan Xiong <jinshan.xiong@intel.com>
Mon, 16 Oct 2017 18:44:00 +0000 (11:44 -0700)
committerMike Pershin <mike.pershin@intel.com>
Sat, 21 Oct 2017 06:55:39 +0000 (06:55 +0000)
Add dom into racer test and fix a problem where it checks OSTCOUNT
to decide if to use specific layout.

Test-parameters: trivial testlist=racer,racer,racer mdscount=1 mdtcount=1

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ie3245644589f636201d11d9fc2ce86ecec82649e
Reviewed-on: https://review.whamcloud.com/29631
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
lustre/tests/racer/file_create.sh

index b1704d3..cf7b6f2 100755 (executable)
@@ -5,15 +5,44 @@ DIR=$1
 MAX=$2
 MAX_MB=${RACER_MAX_MB:-8}
 
+. $LUSTRE/tests/test-framework.sh
+
 OSTCOUNT=${OSTCOUNT:-$($LFS df $DIR 2> /dev/null | grep -c OST)}
 
+layout=(raid0 raid0)
+
+# check if it supports PFL layout
+[[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.0) ]] &&
+       layout+=(pfl pfl pfl)
+
+# check if it supports DoM
+[[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.53) ]] &&
+       layout+=(dom dom)
+
+echo "layout: ${layout[*]}"
+
 while /bin/true; do
        file=$((RANDOM % MAX))
        # $RANDOM is between 0 and 32767, and we want $blockcount in 64kB units
        blockcount=$((RANDOM * MAX_MB / 32 / 64))
        stripecount=$((RANDOM % (OSTCOUNT + 1)))
-       [ $OSTCOUNT -gt 0 ] &&
-               $LFS setstripe -c $stripecount $DIR/$file 2> /dev/null
-       dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount 2> /dev/null
+
+       [ $stripecount -gt 0 ] && {
+               stripesize=$(((RANDOM % 16 + 1) * 64))K
+               pattern=${layout[$RANDOM % ${#layout[*]}]}
+
+               case $pattern in
+               dom) opt="-E $stripesize -L mdt -E eof -c $stripecount -S 1M" ;;
+               pfl) opt="-E 1M -S $stripesize -E eof -c $stripecount -S 2M" ;;
+               raid0) opt="-S $stripesize -c $stripecount" ;;
+               esac
+
+               $LFS setstripe $opt $DIR/$file 2> /dev/null || true
+       }
+
+       # offset between 0 and 16MB (256 64k chunks), with 1/2 at offset 0
+       seek=$((RANDOM / 64)); [ $seek -gt 256 ] && seek=0
+       dd if=/dev/zero of=$DIR/$file bs=64k count=$blockcount \
+               seek=$seek 2> /dev/null || true
 done