-
Notifications
You must be signed in to change notification settings - Fork 224
Add device passthrough tests for Cloud Hypervisor platform #4250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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]>
4efc1d3 to
97e0658
Compare
There was a problem hiding this 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
netperfandiperf3tool 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
lisa/microsoft/testsuites/performance/networkperf_passthrough.py
Outdated
Show resolved
Hide resolved
lisa/microsoft/testsuites/performance/networkperf_passthrough.py
Outdated
Show resolved
Hide resolved
lisa/microsoft/testsuites/device_passthrough/functional_tests.py
Outdated
Show resolved
Hide resolved
lisa/microsoft/testsuites/device_passthrough/functional_tests.py
Outdated
Show resolved
Hide resolved
lisa/microsoft/testsuites/device_passthrough/functional_tests.py
Outdated
Show resolved
Hide resolved
baf8803 to
9b52fa0
Compare
9b52fa0 to
8063de9
Compare
| 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 |
There was a problem hiding this comment.
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'
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok , pls check now.
09b7199 to
8063de9
Compare
8063de9 to
f3a8325
Compare
- 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.
f3a8325 to
bee6d40
Compare
This PR adds comprehensive device passthrough testing support for the Cloud Hypervisor platform.
Changes included:
Device Passthrough Functional Tests
NIC Passthrough Performance Tests
Tool Enhancements
interface_ipparameter tonetperf.run_as_server()andnetperf.run_as_client_async()interface_ipparameter toiperf3.run_as_server_async()Signed-off-by: Smit Gardhariya [email protected]
Co-authored-by: Vivek Yadav [email protected]