From a0e6c88daaba9036269e35491b15269a8552eb70 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Tue, 31 Mar 2020 17:21:10 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1605 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- test/vhost/common.sh | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/test/vhost/common.sh b/test/vhost/common.sh index 8b3ac6403..a82a1aae8 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -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