Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion qubes/ext/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def __init__(self, port: Port, libvirt_name=None):
dev_match = self._libvirt_regex.match(libvirt_name)
if not dev_match:
raise UnsupportedDevice(libvirt_name)
port_id = sbdf_to_path(libvirt_name)
try:
port_id = sbdf_to_path(libvirt_name)
except (AssertionError, ValueError, KeyError):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like catching AssertionError here. Asserts should never trigger - if they do, it means a but somewhere (might be also in the assert condition itself).

But also, shouldn't the VMD case be handled by the regex match above already? It has 4 hex digits for segment, but VMD devices have 5, so it shouldn't match there.

raise UnsupportedDevice(libvirt_name)
port = Port(
backend_domain=port.backend_domain,
port_id=port_id,
Expand Down