Skip to content

libvirt: resolve passthrough BDFs from visible devices#4371

Merged
anirudhrb merged 1 commit intomainfrom
vyadav_pass3
Mar 25, 2026
Merged

libvirt: resolve passthrough BDFs from visible devices#4371
anirudhrb merged 1 commit intomainfrom
vyadav_pass3

Conversation

@vyadavmsft
Copy link
Copy Markdown
Collaborator

@vyadavmsft vyadavmsft commented Mar 20, 2026

Improve libvirt PCI passthrough handling by resolving requested BDFs to visible nested devices before building IOMMU-backed pools.

This commit also tolerates non-PCI management NICs when determining the primary NIC exclusion set and reuses the same BDF resolution path in device passthrough functional validation for BDF-only pools so host sysfs lookup follows the resolved passthrough device.

Description

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:

verify_device_passthrough_on_guest

Impacted LISA Features:

NIC Passthrough

Tested Azure Marketplace Images:

-Local HyperV VHD

Test Results

verify_device_passthrough_on_guest

Image VM Size Result
PASSED

Copilot AI review requested due to automatic review settings March 20, 2026 20:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves libvirt PCI passthrough robustness in nested scenarios by resolving runbook-requested BDFs to PCI devices actually visible on the libvirt host before building IOMMU-backed pools, and aligns functional validation to read sysfs from the resolved device.

Changes:

  • Add BDF resolution logic for PCI BDF-based pools, including candidate discovery via host-visible passthrough devices.
  • Tolerate non-PCI-backed management NICs when computing the “primary NIC” IOMMU exclusion set.
  • Update device passthrough functional validation to use the same BDF resolution path before reading vendor/device IDs from sysfs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Resolve requested BDFs to host-visible devices; cache IOMMU device paths; improve IOMMU-group lookup error reporting; tolerate non-PCI management NICs.
lisa/microsoft/testsuites/device_passthrough/functional_tests.py Resolve BDFs before sysfs vendor/device reads for BDF-only pools to match libvirt host-visible devices.

Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Outdated
Copilot AI review requested due to automatic review settings March 23, 2026 16:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Outdated
Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py
Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Outdated
Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

lisa/sut_orchestrator/util/device_pool.py:10

  • DeviceLocationPathIdentifier is imported from lisa.sut_orchestrator.util.schema, but that symbol doesn't exist in that module (schema.py currently defines only VendorDeviceIdIdentifier/PciAddressIdentifier/etc.). This will raise an ImportError at runtime and prevent any platform from loading BaseDevicePool. Either add/restore DeviceLocationPathIdentifier to util/schema.py (and update HostDevicePoolSchema.devices accordingly), or remove this import/type check and rely on the dict location_path handling that already exists in _configure_dict_identifier_pool.
from lisa.sut_orchestrator.util.schema import (
    DeviceLocationPathIdentifier,
    HostDevicePoolSchema,
    HostDevicePoolType,
    PciAddressIdentifier,
    VendorDeviceIdIdentifier,
)

Comment thread lisa/sut_orchestrator/libvirt/libvirt_device_pool.py Outdated
anirudhrb
anirudhrb previously approved these changes Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread lisa/microsoft/testsuites/device_passthrough/functional_tests.py Outdated
@vyadavmsft
Copy link
Copy Markdown
Collaborator Author

@anirudhrb Fixed some lint issues. please approve again.

@vyadavmsft vyadavmsft requested a review from anirudhrb March 25, 2026 08:01
@anirudhrb anirudhrb merged commit 5785e83 into main Mar 25, 2026
58 checks passed
@anirudhrb anirudhrb deleted the vyadav_pass3 branch March 25, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants