Skip to content

Commit

Permalink
virtio_mode: updates PCI patterns according to the numerical ID
Browse files Browse the repository at this point in the history
Updates the case logic, checking the numerical ID of the PCI devices
instead of the full name, that could be updated without notice.
In order to support 0.9 and 1.0 virtio devices, the pattern
-interpreted as a list now- contains both IDs.

Signed-off-by: mcasquer <[email protected]>
  • Loading branch information
mcasquer committed Jul 18, 2023
1 parent e8a8b03 commit 35141d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 9 additions & 6 deletions qemu/tests/cfg/virtio_mode.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
virtio_dev_disable_legacy = off
virtio_mode = legacy
variants:
# Numerical PCI ids have been used as a reference
# https://man7.org/linux/man-pages/man5/pci.ids.5.html
# https://github.com/pciutils/pciids/blob/master/pci.ids
- with_netkvm:
only virtio_net
driver_name = netkvm
Expand All @@ -30,12 +33,12 @@
driver_verifier += " ndis"
device_type = "virtio-net-pci"
device_name = "Red Hat VirtIO Ethernet Adapter.*"
pci_id_pattern = "(\d+:\d+\.\d+)\s+Ethernet controller:.*?Virtio network device"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1000|1041)"
- with_viorng:
driver_name = viorng
device_type = "virtio-rng-pci"
device_name = "VirtIO RNG Device"
pci_id_pattern = "(\d+:\d+\.\d+)\s+Unclassified device\s.*?Virtio RNG"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1005|1044)"
no_virtio_rng:
virtio_rngs += " rng0"
variants:
Expand All @@ -56,26 +59,26 @@
driver_name = viostor
device_type = "virtio-blk-pci"
device_name = "Red Hat VirtIO SCSI controller"
pci_id_pattern = "(\d+:\d+\.\d+)\s+SCSI storage controller:.*?Virtio block device"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1001|1042)"
- with_vioscsi:
only virtio_scsi
driver_name = vioscsi
device_type = "virtio-scsi-pci"
device_name = "Red Hat VirtIO SCSI pass-through controller"
pci_id_pattern = "(\d+:\d+\.\d+)\s+SCSI storage controller:.*?Virtio SCSI"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1004|1048)"
- with_vioserial:
only Windows
driver_name = vioser
serials += " vs"
serial_type_vs = virtserialport
device_type = "virtio-serial-pci"
device_name = "VirtIO Serial Driver"
pci_id_pattern = "(\d+:\d+\.\d+)\s+Communication controller:.*?Virtio console"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1003|1043)"
- with_balloon:
driver_name = balloon
balloon = balloon0
balloon_dev_devid = balloon0
balloon_dev_add_bus = yes
device_name = "VirtIO Balloon Driver"
device_type = "virtio-balloon-pci"
pci_id_pattern = "(\d+:\d+\.\d+)\s+Unclassified device\s.*?Virtio memory balloon"
pci_id_patterns = "(\d+:\d+\.\d+).*?1af4:(?:1002|1045)"
10 changes: 7 additions & 3 deletions qemu/tests/virtio_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ def verify_virtio_mode_guest_linux(session):
:param session: shell Object
"""
pci_info = session.cmd_output("lspci")
pci_id_pattern = params["pci_id_pattern"]
pci_n = re.findall(pci_id_pattern, pci_info)[0]
pci_info = session.cmd_output("lspci -n")
pci_id_patterns = params.get("pci_id_patterns").split()
for pci_id_pattern in pci_id_patterns:
pci_n = re.findall(pci_id_pattern, pci_info)
if pci_n:
pci_n = pci_n[0]
break
if not pci_n:
test.error("Can't get the pci id for device")

Expand Down

0 comments on commit 35141d0

Please sign in to comment.