diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index 660f32e1a..4604b8a06 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -9,7 +9,10 @@ function check_qos_works_well() { local enable_limit=$1 local iops_limit=$2/1000 local retval=0 - local read_iops=$($fio_py 8192 64 randread 5 | grep "\(read: IOPS=\|write: IOPS=\)" | + + $fio_py 8192 64 randread 5 > fio.txt + + local read_iops=$(cat fio.txt | grep "\(read: IOPS=\|write: IOPS=\)" | awk -F, '{print $1}' | awk -F= '{print $2}' | tr -d [k]) if [ $enable_limit = true ]; then retval=$(echo "$iops_limit*0.9 < $read_iops && $read_iops < $iops_limit*1.01" | bc) @@ -68,7 +71,7 @@ sleep 1 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT -trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; rm -f fio.txt; killprocess $pid; exit 1" SIGINT SIGTERM EXIT # Limit the I/O rate by RPC, then confirm the observed rate matches. $rpc_py set_bdev_qos_limit_iops Malloc0 $IOPS_LIMIT @@ -84,6 +87,7 @@ check_qos_works_well true $IOPS_LIMIT echo "I/O rate limiting tests successful" iscsicleanup +rm -f fio.txt $rpc_py delete_target_node 'iqn.2016-06.io.spdk:Target1' rm -f ./local-job0-0-verify.state