test/vhost: run fio bdev plugin in test VMs

Allow to run fio bdev plugin with attached virtio
devices. This might allow to get better performance
results when running performance tests.
Fio is not run in client-server mode due to problems
experienced when running fio plugin that way.

These changes are not generic and will not work
in the CI out of the box. New VM image must be crafted
in order to run fio in this mode. VM must have compiled
SPDK and FIO binary already in place.

Change-Id: I2e957e1e3a573cc899fcfbe5918193e1af6a9a63
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Karol Latecki 2020-03-31 17:21:10 +02:00 committed by Tomasz Zawadzki
parent 451c9e7b69
commit a0e6c88daa

View File

@ -1008,6 +1008,34 @@ function vm_check_scsi_location()
fi
}
# Note: to use this function your VM should be run with
# appropriate memory and with SPDK source already cloned
# and compiled in /root/spdk.
function vm_check_virtio_location()
{
vm_exec $1 NRHUGE=512 /root/spdk/scripts/setup.sh
vm_exec $1 "cat > /root/bdev.conf" <<- EOF
[VirtioPci]
Enable Yes
EOF
vm_exec $1 "cat /root/bdev.conf"
vm_exec $1 "bash -s" <<- EOF
set -e
rootdir="/root/spdk"
source /root/spdk/test/common/autotest_common.sh
discover_bdevs /root/spdk /root/bdev.conf | jq -r '[.[].name] | join(" ")' > /root/fio_bdev_filenames
exit 0
EOF
SCSI_DISK=$(vm_exec $1 cat /root/fio_bdev_filenames)
if [[ -z "$SCSI_DISK" ]]; then
error "no virtio test disk found!"
return 1
fi
}
# Script to perform scsi device reset on all disks in VM
# param $1 VM num
# param $2..$n Disks to perform reset on
@ -1039,6 +1067,7 @@ function run_fio()
local out=""
local vm
local run_server_mode=true
local run_plugin_mode=false
local fio_start_cmd
local fio_output_format="normal"
@ -1052,6 +1081,10 @@ function run_fio()
mkdir -p $out
;;
--local) run_server_mode=false ;;
--plugin)
notice "Using plugin mode. Disabling server mode."
run_plugin_mode=true
run_server_mode=false ;;
--json) fio_output_format="json" ;;
--hide-results) hide_results=true ;;
*)
@ -1091,11 +1124,16 @@ function run_fio()
if ! $run_server_mode; then
if [[ -n "$fio_bin" ]]; then
vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' < $fio_bin
if ! $run_plugin_mode; then
vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' < $fio_bin
vm_fio_bin="/root/fio"
else
vm_fio_bin="/usr/src/fio/fio"
fi
fi
notice "Running local fio on VM $vm_num"
vm_exec $vm_num "/root/fio --output=/root/$job_fname.out --output-format=$fio_output_format /root/$job_fname" &
vm_exec $vm_num "$vm_fio_bin --output=/root/$job_fname.out --output-format=$fio_output_format /root/$job_fname" &
vm_exec_pids+=("$!")
fi
done