From d2e2758e0d1420a5b5a284a8087343fbf3198cbe Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 24 Apr 2019 11:02:28 +0200 Subject: [PATCH] test/qos: precalculate bandwidth limits Don't do it at runtime, do it just once on script initialization. Change-Id: Idb345fc0f72d3a41072d830b11a520584ec8b321 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451886 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/iscsi_tgt/qos/qos.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index b4112a26c..e3495b142 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -16,10 +16,6 @@ function check_qos_works_well() { local retval=0 local iostats - if [ $LIMIT_TYPE = BANDWIDTH ]; then - qos_limit=$((qos_limit*1024*1024)) - fi - iostats=$($rpc_py get_bdevs_iostat -b $3) start_io_count=$(jq -r '.bdevs[0].num_read_ops' <<< "$iostats") start_bytes_read=$(jq -r '.bdevs[0].bytes_read' <<< "$iostats") @@ -74,8 +70,10 @@ MALLOC_BDEV_SIZE=64 MALLOC_BLOCK_SIZE=512 ENABLE_QOS=true IOPS_LIMIT=20000 -BANDWIDTH_LIMIT=20 -READ_BANDWIDTH_LIMIT=10 +BANDWIDTH_LIMIT_MB=20 +BANDWIDTH_LIMIT=$(($BANDWIDTH_LIMIT_MB*1024*1024)) +READ_BANDWIDTH_LIMIT_MB=10 +READ_BANDWIDTH_LIMIT=$(($READ_BANDWIDTH_LIMIT_MB*1024*1024)) LIMIT_TYPE=IOPS rpc_py="$rootdir/scripts/rpc.py" fio_py="$rootdir/scripts/fio.py" @@ -125,7 +123,7 @@ if [ $ENABLE_QOS = true ]; then # Limit the I/O bandwidth rate by RPC, then confirm the observed rate matches. LIMIT_TYPE=BANDWIDTH - $rpc_py set_bdev_qos_limit Malloc0 --rw_ios_per_sec 0 --rw_mbytes_per_sec $BANDWIDTH_LIMIT + $rpc_py set_bdev_qos_limit Malloc0 --rw_ios_per_sec 0 --rw_mbytes_per_sec $BANDWIDTH_LIMIT_MB check_qos_works_well true $BANDWIDTH_LIMIT Malloc0 false # Now disable the bandwidth rate limiting, and confirm the observed rate is not limited anymore. @@ -133,7 +131,7 @@ if [ $ENABLE_QOS = true ]; then check_qos_works_well false $BANDWIDTH_LIMIT Malloc0 false # Limit the I/O bandwidth rate again with both read/write and read/only. - $rpc_py set_bdev_qos_limit Malloc0 --rw_mbytes_per_sec $BANDWIDTH_LIMIT --r_mbytes_per_sec $READ_BANDWIDTH_LIMIT + $rpc_py set_bdev_qos_limit Malloc0 --rw_mbytes_per_sec $BANDWIDTH_LIMIT_MB --r_mbytes_per_sec $READ_BANDWIDTH_LIMIT_MB check_qos_works_well true $READ_BANDWIDTH_LIMIT Malloc0 false echo "I/O bandwidth limiting tests successful" fi