test/qos: use a single RPC for getting bandwidth and iops stats

Do a single RPC instead of two, cache the result,
parse it twice.

Change-Id: Ib0ae19da5cb6b6db7bf1a46c3960104d1975afdd
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451885
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Darek Stojaczyk 2019-04-24 10:57:07 +02:00
parent c55c85f807
commit ac8921f56c

View File

@ -14,26 +14,27 @@ function check_qos_works_well() {
local qos_limit=$2
local check_qos=$4
local retval=0
local iostats
if [ $LIMIT_TYPE = BANDWIDTH ]; then
qos_limit=$((qos_limit*1024*1024))
fi
if [ $LIMIT_TYPE = IOPS ]; then
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
else
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
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")
$fio_py iscsi 1024 128 randread 5 1
if [ $LIMIT_TYPE = IOPS ]; then
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
else
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
fi
iostats=$($rpc_py get_bdevs_iostat -b $3)
end_io_count=$(jq -r '.bdevs[0].num_read_ops' <<< "$iostats")
end_bytes_read=$(jq -r '.bdevs[0].bytes_read' <<< "$iostats")
read_result=$(((end_io_count-start_io_count)/5))
if [ $LIMIT_TYPE = IOPS ]; then
read_result=$(((end_io_count-start_io_count)/5))
else
read_result=$(((end_bytes_read-start_bytes_read)/5))
fi
if [ $enable_limit = true ]; then
#qos realization is related with bytes transfered.It currently have like 5% variation.