Skip to content

Conversation

@vyadavmsft
Copy link
Collaborator

This PR adds comprehensive device passthrough testing support for the Cloud Hypervisor platform.

Changes included:

  1. Device Passthrough Functional Tests

    • Add test case to verify passthrough devices are visible to guest in Cloud Hypervisor
    • Validates device detection and basic functionality
  2. NIC Passthrough Performance Tests

    • Add network performance tests for NIC passthrough scenarios
    • Support for ntttcp, iperf3, and netperf benchmarks
    • Cover both host-guest and guest-guest scenarios
    • Enable interface-specific testing for passthrough devices
  3. Tool Enhancements

    • Add interface_ip parameter to netperf.run_as_server() and netperf.run_as_client_async()
    • Add interface_ip parameter to iperf3.run_as_server_async()
    • Enables binding network tools to specific interfaces for accurate passthrough testing
    • Maintains backward compatibility with optional parameters

Signed-off-by: Smit Gardhariya [email protected]
Co-authored-by: Vivek Yadav [email protected]

Add test case to verify if passthrough-devices
are visible to guest for CH platform

Signed-off-by: Smit Gardhariya <[email protected]>
Add testcases for nttcp/iperf3/netperf for
NIC device passthrough cases for host-guest
and guest-guest scenarios.

Signed-off-by: Smit Gardhariya <[email protected]>
Copy link
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

Adds Cloud Hypervisor–specific device passthrough validation and NIC passthrough performance testing, plus small network tool enhancements to support interface-bound benchmarking.

Changes:

  • Extend netperf and iperf3 tool wrappers with optional interface/IP binding parameters.
  • Add a new Cloud Hypervisor NIC passthrough performance test suite covering iperf3/netperf/ntttcp scenarios.
  • Add a functional test suite to validate passthrough devices are visible inside the guest.

Reviewed changes

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

Show a summary per file
File Description
lisa/tools/netperf.py Adds optional local interface IP binding support for netserver/netperf client.
lisa/tools/iperf3.py Adds optional server bind address support (-B) for interface-specific testing.
lisa/microsoft/testsuites/performance/networkperf_passthrough.py Introduces new NIC passthrough performance suite for Cloud Hypervisor (host-guest and guest-guest).
lisa/microsoft/testsuites/performance/common.py Enhances perf helpers to optionally bind to internal addresses for interface-specific runs.
lisa/microsoft/testsuites/device_passthrough/functional_tests.py Adds functional validation that passthrough devices appear in-guest via lspci.
lisa/microsoft/testsuites/device_passthrough/init.py New package init for the passthrough functional suite.
**Key Test Cases:**
verify_device_passthrough_on_guest|perf_tcp_iperf_passthrough_host_guest|perf_tcp_single_pps_passthrough_host_guest|perf_tcp_iperf_passthrough_two_guest

**Impacted LISA Features:**
NetworkInterface

**Tested Azure Marketplace Images:**
- canonical 0001-com-ubuntu-server-jammy 22_04-lts latest

@vyadavmsft vyadavmsft force-pushed the vyadav_nic_passthrough branch 5 times, most recently from baf8803 to 9b52fa0 Compare January 23, 2026 22:12
@vyadavmsft vyadavmsft force-pushed the vyadav_nic_passthrough branch from 9b52fa0 to 8063de9 Compare January 26, 2026 18:14
@vyadavmsft vyadavmsft requested a review from LiliDeng January 26, 2026 18:15
from lisa.environment import Environment, Node
from lisa.operating_system import Windows
from lisa.sut_orchestrator import CLOUD_HYPERVISOR
from lisa.sut_orchestrator.libvirt.context import get_node_context
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, I met below issue.

File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\app\lsg-lisa\lisa\lisa\microsoft\testsuites\performance\networkperf_passthrough.py", line 27, in <module>
    from lisa.sut_orchestrator.libvirt.context import get_node_context
  File "C:\app\lsg-lisa\lisa\lisa\sut_orchestrator\libvirt\context.py", line 5, in <module>
    import libvirt
ModuleNotFoundError: No module named 'libvirt'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted TYPE_CHECKING imports to normal imports because CloudHypervisorPlatform and BaseLibvirtNodeSchema are used at runtime (in cast() and get_extended_runbook() calls).
TYPE_CHECKING imports are only available during static type checking, not at runtime, which caused NameError when the test executed.
These classes must be imported normally since they're needed as actual objects during program execution.

Copy link
Collaborator

Choose a reason for hiding this comment

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

when run azure platform, we met the issue, please refer to https://github.com/microsoft/lisa/blob/main/lisa/microsoft/testsuites/cvm/cvm_attestation.py#L145 to make the changes.

2026-01-30 03:18:28.853[6624][ERROR] lisa. No module named 'libvirt'
Traceback (most recent call last):
  File "C:\app\lsg-lisa\lisa\lisa\main.py", line 159, in cli
    exit_code = main()
                ^^^^^^
  File "C:\app\lsg-lisa\lisa\lisa\main.py", line 141, in main
    exit_code = args.func(args)
                ^^^^^^^^^^^^^^^
  File "C:\app\lsg-lisa\lisa\lisa\commands.py", line 23, in run
    builder = RunbookBuilder.from_path(args.runbook, args.variables)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\app\lsg-lisa\lisa\lisa\parameter_parser\runbook.py", line 86, in from_path
    builder._import_extensions()
  File "C:\app\lsg-lisa\lisa\lisa\parameter_parser\runbook.py", line 190, in _import_extensions
    import_package(path, name)
  File "C:\app\lsg-lisa\lisa\lisa\util\package.py", line 109, in import_package
    _import_module(
  File "C:\app\lsg-lisa\lisa\lisa\util\package.py", line 57, in _import_module
    importlib.import_module(name=module_name, package=root_package_name)
  File "C:\Python\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\app\lsg-lisa\lisa\lisa\microsoft\testsuites\device_passthrough\functional_tests.py", line 8, in <module>
    from lisa.sut_orchestrator.libvirt.ch_platform import CloudHypervisorPlatform
  File "C:\app\lsg-lisa\lisa\lisa\sut_orchestrator\libvirt\ch_platform.py", line 17, in <module>
    from lisa.sut_orchestrator.libvirt.context import (
  File "C:\app\lsg-lisa\lisa\lisa\sut_orchestrator\libvirt\context.py", line 5, in <module>
    import libvirt
ModuleNotFoundError: No module named 'libvirt'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok , pls check now.

@vyadavmsft vyadavmsft force-pushed the vyadav_nic_passthrough branch 2 times, most recently from 09b7199 to 8063de9 Compare January 30, 2026 00:56
@vyadavmsft vyadavmsft requested a review from LiliDeng January 30, 2026 02:58
@vyadavmsft vyadavmsft force-pushed the vyadav_nic_passthrough branch from 8063de9 to f3a8325 Compare January 30, 2026 03:12
- Add missing __init__.py for device_passthrough package
- Fix unsafe pool.devices[0] access with validation
- Fix class name typo: NetworkPerformace -> NetworkPerformance
- Add validation for device_addr to prevent None usage
- Fix logic bug: validate only the node parameter, not all node spaces
- Remove unused parameters (log, log_path, variables) from functional test
- Update descriptions: replace 'sriov' with 'passthrough' for accuracy
- Improve error messages with more context
- Add timeout documentation comments
- Clarify server_ip vs interface_ip usage in common.py
- Add pool_type validation before dictionary access
- Move device_passthrough tests to correct location for test discovery

1. Identifies interface by PCI address first (before dhclient)
2. Brings interface UP with 'ip link set up'
3. Waits for carrier detection (30s timeout)
4. Then runs dhclient to get IP address

This ensures the physical link is established before DHCP configuration.
@vyadavmsft vyadavmsft force-pushed the vyadav_nic_passthrough branch from f3a8325 to bee6d40 Compare January 30, 2026 06:41
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.

4 participants