From c6d17fea785a548676e5e2f33beabc89d235d26b Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 29 Mar 2023 11:11:13 +0000 Subject: [PATCH] vfio: Extend VFIO test Extend the VFIO test to check for any VFIO device not only for network devices. Fixes: #5728 --- functional/vfio/run.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/functional/vfio/run.sh b/functional/vfio/run.sh index b3e88b081..757f21466 100755 --- a/functional/vfio/run.sh +++ b/functional/vfio/run.sh @@ -27,7 +27,7 @@ IMAGE_TYPE= # Option to choose an alternative PCI device for the VFIO test VFIO_PCI_CLASS=${VFIO_PCI_CLASS:-"Ethernet controller"} -VFIO_PCI_NAME=${VFIO_PCI_NAME:-"Virtio network device"} +VFIO_PCI_NAME=${VFIO_PCI_NAME:-"Virtio.*network device"} VFIO_CHECK_GUEST_KERNEL=${VFIO_CHECK_GUEST_KERNEL:-"ip a | grep \"eth\" || die \"Missing VFIO network interface\""} VFIO_HOTPLUG=${VFIO_HOTPLUG:-"bridge-port"} VFIO_COLDPLUG=${VFIO_COLDPLUG:-"bridge-port"} @@ -197,19 +197,24 @@ setup_configuration_file() { if [ "$HYPERVISOR" = "qemu" ]; then sed -i 's|^machine_type.*|machine_type = "'${MACHINE_TYPE}'"|g' "${kata_config_file}" # Make sure we have set hot_plug_vfio to a reasonable value - sed -i -e 's|^#hot_plug_vfio=.*$|hot_plug_vfio="bridge-port"|' -e 's|^chot_plug_vfio=.*$|hot_plug_vfio="bridge-port"|' "${kata_config_file}" + sed -i -e 's|^#hot_plug_vfio =.*$|hot_plug_vfio = "bridge-port"|' -e 's|^hot_plug_vfio =.*$|hot_plug_vfio = "bridge-port"|' "${kata_config_file}" else warn "Variable machine_type only applies to qemu. It will be ignored" fi fi - if [ "${VFIO_HOTPLUG}" = "root-port" ]; then - - sudo sed -i -e 's|^#hot_plug_vfio|hot_plug_vfio="root-port"|' -e 's|^chot_plug_vfio=.*$|hot_plug_vfio="root-port"|' "${SYSCONFIG_FILE}" + if [ "${VFIO_HOTPLUG}" != "bridge-port" ]; then + sed -i -e "s|^#hot_plug_vfio =.*$|hot_plug_vfio = \"${VFIO_HOTPLUG}\"|" -e "s|^hot_plug_vfio =.*$|hot_plug_vfio = \"${VFIO_HOTPLUG}\"|" "${kata_config_file}" + cat "${kata_config_file}" | grep -v '#' | grep -v '^$' + fi + if [ "${VFIO_COLDPLUG}" != "bridge-port" ]; then + sed -i -e "s|^#cold_plug_vfio =.*$|cold_plug_vfio = \"${VFIO_HOTPLUG}\"|" -e "s|^cold_plug_vfio =.*$|cold_plug_vfio = \"${VFIO_HOTPLUG}\"|" "${kata_config_file}" cat "${kata_config_file}" | grep -v '#' | grep -v '^$' fi + + if [ -n "${SANDBOX_CGROUP_ONLY}" ]; then sed -i 's|^sandbox_cgroup_only.*|sandbox_cgroup_only='${SANDBOX_CGROUP_ONLY}'|g' "${kata_config_file}" fi