Skip to content
Draft
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
17 changes: 17 additions & 0 deletions vhotplug/qemulink.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,23 @@ async def add_pci_device(self, pci_info: PCIInfo) -> None:
"id": qemuid,
}
)

# Verify the device appeared with correct VID/DID in the guest PCI tree
verified_id = await self._find_pci_device(pci_info)
if verified_id is None:
logger.error(
"PCI device %s attached but not found with expected VID:DID %s:%s in guest — possible config space corruption",
pci_info.address,
pci_info.vid,
pci_info.did,
)
# Remove the corrupted device
await self._remove_pci_device_by_qemu_id(qemuid)
raise RuntimeError(
f"PCI device {pci_info.address} failed post-attach verification "
f"(expected {pci_info.vid}:{pci_info.did})"
)

logger.info("Attached PCI device: %s", pci_info.friendly_name())

async def _remove_pci_device_by_qemu_id(self, qemuid: str) -> None:
Expand Down