Whamcloud - gitweb
LU-9140 nrs: calculate the measured rate according to dd runtime 10/27110/4
authorQian Yingjin <qian@ddn.com>
Mon, 15 May 2017 14:04:48 +0000 (22:04 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 24 May 2017 07:33:45 +0000 (07:33 +0000)
This patch help to calculate the measured IOPS by dd according
to dd runtime, instead of obtaining the result from the
performance data of dd output which value changes according to
its unit: 'MB/s', 'GB/s' or 'kB/s'.

Change-Id: Iace926d5c001f20b1c1d89ad6124d14a80316e86
Test-Parameters: trivial testlist=sanityn,sanityn,sanity
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/27110
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
lustre/tests/sanityn.sh

index a0bfb32..8275cc9 100755 (executable)
@@ -3135,6 +3135,17 @@ tbf_rule_operate()
                error "failed to run operate '$*' on TBF rules"
 }
 
+cleanup_tbf_verify()
+{
+       local rc=0
+       trap 0
+       echo "cleanup_tbf $DIR/$tdir"
+       rm -rf $DIR/$tdir
+       rc=$?
+       wait_delete_completed
+       return $rc
+}
+
 tbf_verify() {
        local dir=$DIR/$tdir
        local client1=${CLIENT1:-$(hostname)}
@@ -3144,29 +3155,32 @@ tbf_verify() {
        $LFS setstripe -c 1 $dir || error "setstripe to $dir failed"
        chmod 777 $dir
 
+       trap cleanup_tbf_verify EXIT
        echo "Limited write rate: $1, read rate: $2"
        echo "Verify the write rate is under TBF control"
-       local rate=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
-               bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $8}')
-       echo "Write speed is $rate"
+       local runtime=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
+               bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $6}')
+       local rate=$(bc <<< "scale=6; 100 / $runtime")
+       echo "Write runtime is $runtime s, speed is $rate IOPS"
 
        # verify the write rate does not exceed 110% of TBF limited rate
        [ $(bc <<< "$rate < 1.1 * $1") -eq 1 ] ||
-               error_ignore LU-9140 "The write rate ($rate) exceeds 110% of preset rate ($1)"
+               error "The write rate ($rate) exceeds 110% of preset rate ($1)"
 
        cancel_lru_locks osc
 
        echo "Verify the read rate is under TBF control"
-       rate=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
-               bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $8}')
-       echo "Read speed is $rate"
+       runtime=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
+               bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $6}')
+       rate=$(bc <<< "scale=6; 100 / $runtime")
+       echo "Read runtime is $runtime s, speed is $rate IOPS"
 
        # verify the read rate does not exceed 110% of TBF limited rate
        [ $(bc <<< "$rate < 1.1 * $2") -eq 1 ] ||
-               error_ignore LU-9140 "The read rate ($rate) exceeds 110% of preset rate ($2)"
+               error "The read rate ($rate) exceeds 110% of preset rate ($2)"
 
        cancel_lru_locks osc
-       rm -rf $dir || error "rm -rf $dir failed"
+       cleanup_tbf_verify || error "rm -rf $dir failed"
 }
 
 test_77e() {