Skip to content

Commit ab57225

Browse files
committed
Remove hardcoded driver values and improve config organization
- Remove hardcoded expr_driver from global config - Move expr_driver under mlx5_vfio variant for better organization - Move test_pf under x86_64 architecture for aarch64 compatibility - Remove hardcoded fallback in test code for expr_driver parameter - Improve backward compatibility and configuration flexibility Signed-off-by: hholoubk <[email protected]> AI assisted code and commit. Human reviewed.
1 parent 53518c5 commit ab57225

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

libvirt/tests/cfg/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
- sriov.plug_unplug.vfio_variant_driver:
22
type = sriov_attach_detach_device_vfio_variant_driver
33
start_vm = "no"
4-
expr_driver = "mlx5_vfio_pci"
54
ping_dest = "www.redhat.com"
65
test_pf = "ens3f0np0"
76

87
only x86_64, aarch64
8+
x86_64:
9+
test_pf = "ens3f0np0"
910
variants:
1011
- mlx5_vfio:
12+
expr_driver = "mlx5_vfio_pci"
1113
driver_dict = {'driver': {'driver_attr': {'name': 'vfio', 'model': 'mlx5_vfio_pci'}}}
1214
- vfio_vfio:
1315
driver_dict = {'driver': {'driver_attr': {'name': 'vfio', 'model': 'vfio_pci'}}}

libvirt/tests/src/sriov/plug_unplug/sriov_attach_detach_device_vfio_variant_driver.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def parse_iface_dict(pf_pci):
4141

4242
dev_type = params.get("dev_type", "hostdev_interface")
4343
device_type = "hostdev" if dev_type == "hostdev_device" else "interface"
44-
expr_driver = params.get("expr_driver", "mlx5_vfio_pci")
44+
expr_driver = params.get("expr_driver")
4545
test_pf = params.get("test_pf")
4646
pf_pci = utils_sriov.get_pf_pci(test_pf=test_pf)
4747
iface_number = int(params.get("iface_number", "1"))
@@ -81,7 +81,10 @@ def parse_iface_dict(pf_pci):
8181
test.log.debug(f"Actual XML: {actual_vm_hostdev}")
8282
if act_hostdev_dict.get("driver")["driver_attr"].get("name") != "vfio":
8383
test.fail("The hostdev driver is not set to VFIO.")
84-
libvirt_vfio.check_vfio_pci(vf_pci, exp_driver=expr_driver)
84+
if expr_driver:
85+
libvirt_vfio.check_vfio_pci(vf_pci, exp_driver=expr_driver)
86+
else:
87+
libvirt_vfio.check_vfio_pci(vf_pci)
8588

8689
test.log.info("TEST_STEP: ping test from VM to outside")
8790
if sriov_vfio.is_linked(pf_name=test_pf) and ping_dest:

0 commit comments

Comments
 (0)