test: update qos.sh to add new test cases
Currently, SPDK can support bandwidth limiting. So add bandwidth test cases into the qos.sh. Change-Id: I85930506b296d6a94bd7dbb101a34ef804cd100e Signed-off-by: Liang Yan <liang.z.yan@intel.com> Reviewed-on: https://review.gerrithub.io/432141 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f50d7325f8
commit
7b00091ac6
@ -7,25 +7,40 @@ source $rootdir/test/iscsi_tgt/common.sh
|
||||
|
||||
function check_qos_works_well() {
|
||||
local enable_limit=$1
|
||||
local iops_limit=$2
|
||||
local qos_limit=$2
|
||||
local retval=0
|
||||
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
$fio_py 512 64 randread 5
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
if [ $LIMIT_TYPE = BANDWIDTH ]; then
|
||||
qos_limit=$((qos_limit*1024*1024))
|
||||
fi
|
||||
|
||||
read_iops=$(((end_io_count-start_io_count)/5))
|
||||
if [ $LIMIT_TYPE = IOPS ]; then
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
else
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
|
||||
fi
|
||||
|
||||
$fio_py 512 64 randread 5
|
||||
|
||||
if [ $LIMIT_TYPE = IOPS ]; then
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
else
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
|
||||
fi
|
||||
|
||||
read_result=$(((end_io_count-start_io_count)/5))
|
||||
|
||||
if [ $enable_limit = true ]; then
|
||||
retval=$(echo "$iops_limit*0.9 < $read_iops && $read_iops < $iops_limit*1.01" | bc)
|
||||
#qos realization is related with bytes transfered.It currently have like 5% variation.
|
||||
retval=$(echo "$qos_limit*0.95 < $read_result && $read_result < $qos_limit*1.05" | bc)
|
||||
if [ $retval -eq 0 ]; then
|
||||
echo "Failed to limit the io read rate of malloc bdev by qos"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
retval=$(echo "$read_iops > $iops_limit" | bc)
|
||||
retval=$(echo "$read_result > $qos_limit" | bc)
|
||||
if [ $retval -eq 0 ]; then
|
||||
echo "$read_iops less than $iops_limit - expected greater than"
|
||||
echo "$read_result less than $qos_limit - expected greater than"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@ -46,6 +61,8 @@ timing_enter qos
|
||||
MALLOC_BDEV_SIZE=64
|
||||
MALLOC_BLOCK_SIZE=512
|
||||
IOPS_LIMIT=20000
|
||||
BANDWIDTH_LIMIT=10
|
||||
LIMIT_TYPE=IOPS
|
||||
rpc_py="$rootdir/scripts/rpc.py"
|
||||
fio_py="$rootdir/scripts/fio.py"
|
||||
|
||||
@ -88,6 +105,20 @@ $rpc_py set_bdev_qos_limit Malloc0 --rw_ios_per_sec $IOPS_LIMIT
|
||||
check_qos_works_well true $IOPS_LIMIT Malloc0
|
||||
echo "I/O rate limiting tests successful"
|
||||
|
||||
# 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
|
||||
check_qos_works_well true $BANDWIDTH_LIMIT Malloc0
|
||||
|
||||
# Now disable the bandwidth rate limiting, and confirm the observed rate is not limited anymore.
|
||||
$rpc_py set_bdev_qos_limit Malloc0 --rw_mbytes_per_sec 0
|
||||
check_qos_works_well false $BANDWIDTH_LIMIT Malloc0
|
||||
|
||||
# Limit the I/O bandwidth rate again.
|
||||
$rpc_py set_bdev_qos_limit Malloc0 --rw_mbytes_per_sec $BANDWIDTH_LIMIT
|
||||
check_qos_works_well true $BANDWIDTH_LIMIT Malloc0
|
||||
echo "I/O bandwidth limiting tests successful"
|
||||
|
||||
iscsicleanup
|
||||
$rpc_py delete_target_node 'iqn.2016-06.io.spdk:Target1'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user