Add Hyper-V device passthrough validation and recovery#4506
Open
vyadavmsft wants to merge 4 commits into
Open
Conversation
Extend device passthrough functional and network performance suites to run on Hyper-V alongside Cloud Hypervisor. Add Windows ntttcp.exe installation, execution, parsing, firewall setup, and no-sync support for passthrough host-guest tests. Improve passthrough device context resolution, Hyper-V NIC eligibility handling, and reboot readiness waits.
Fail Windows-host passthrough NTTTCP tests when receiver output cannot be parsed instead of reusing sender totals. Add bounded listener readiness checks for Linux and Windows NTTTCP receivers, and fall back to reboot when systemctl reboot exits unsuccessfully.
e3605cc to
5ab1f7c
Compare
Track each stage of Hyper-V DDA assignment so a later failure can unwind earlier host-side changes. The assignment path now records disabled PnP devices, successfully dismounted devices, and devices already attached to the VM. On failure, rollback removes assigned devices from the VM, mounts dismounted devices back to the host, re-enables the PnP devices that were disabled, and reports rollback errors alongside the original assignment error. Add a focused selftest that simulates a second-device dismount failure and verifies rollback removes, mounts, and re-enables devices in the expected order.
⏭️ AI Test Selection — SKIPPED53 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest Selected test cases |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends device passthrough validation and performance coverage by adding Hyper-V DDA rollback behavior, introducing Windows NTTTCP support (for host-to-guest scenarios), and hardening reboot/session readiness handling used by passthrough workflows.
Changes:
- Add Hyper-V DDA assignment rollback logic (with a new selftest to validate rollback ordering).
- Add Windows NTTTCP setup/execution/parsing support and integrate it into passthrough network performance scenarios.
- Improve reboot flow to prefer
systemctl rebootand add a post-reboot SSH “stability” check.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| selftests/test_hyperv_device_pool.py | Adds a regression selftest ensuring DDA rollback runs in the correct order when assignment fails. |
| lisa/tools/reboot.py | Enhances reboot execution path and adds SSH session stabilization after boot time changes. |
| lisa/tools/ntttcp.py | Adds Windows implementation of NTTTCP plus a Linux no_sync option with port-ready waiting. |
| lisa/sut_orchestrator/libvirt/libvirt_device_pool.py | Treats “carrier EINVAL” NICs as eligible for passthrough (link state unknown vs. down). |
| lisa/sut_orchestrator/hyperv/hyperv_device_pool.py | Adds robust DDA assignment rollback (remove, mount back, re-enable PnP + wait). |
| lisa/microsoft/testsuites/performance/networkperf_passthrough.py | Expands passthrough perf coverage to Hyper-V and supports Windows baremetal hosts for NTTTCP host/guest scenarios. |
| lisa/microsoft/testsuites/device_passthrough/functional_tests.py | Extends functional passthrough validation to Hyper-V by resolving vendor/device IDs from Hyper-V instance IDs. |
Comment on lines
+1080
to
+1086
| def _skip_if_windows_server(self, server: RemoteNode, tool_name: str) -> None: | ||
| if isinstance(server.os, Windows): | ||
| raise SkippedException( | ||
| f"Host/guest passthrough performance with {tool_name} requires " | ||
| "Linux server tooling. Use the NTTTCP passthrough cases for " | ||
| "Windows baremetal hosts." | ||
| ) |
Comment on lines
180
to
184
| if last_boot_time < current_boot_time: | ||
| self._wait_ssh_session_stable( | ||
| max(30, time_out - int(timer.elapsed(False))) | ||
| ) | ||
| break |
Comment on lines
+1034
to
+1042
| def setup_system(self, udp_mode: bool = False, set_task_max: bool = True) -> None: | ||
| self.node.tools[PowerShell].run_cmdlet( | ||
| "Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False", | ||
| fail_on_error=False, | ||
| ) | ||
|
|
||
| def restore_system(self, udp_mode: bool = False) -> None: | ||
| return | ||
|
|
Comment on lines
+1104
to
+1106
| connections = NTTTCP_UDP_CONCURRENCY if udp_mode else NTTTCP_TCP_CONCURRENCY | ||
| max_server_threads = 64 | ||
|
|
Comment on lines
+1157
to
+1160
| no_sync=use_no_sync, | ||
| ) | ||
| receiver_result = receiver_process.wait_result(timeout=90) | ||
| finally: |
|
| Count | |
|---|---|
| ✅ Passed | 8 |
| ❌ Failed | 0 |
| ⏭️ Skipped | 1 |
| Total | 9 |
Test case details
| Test Case | Status | Time (s) | Message |
|---|---|---|---|
| perf_ultra_datadisks_1024k (lisa_0_1) | ✅ PASSED | 1072.353 | |
| perf_resource_disk_1024k (lisa_0_8) | ✅ PASSED | 1627.285 | |
| perf_premiumv2_datadisks_1024k (lisa_0_3) | ✅ PASSED | 2466.993 | |
| perf_premiumv2_datadisks_4k (lisa_0_2) | ✅ PASSED | 4393.049 | |
| perf_ultra_datadisks_4k (lisa_0_0) | ✅ PASSED | 4393.157 | |
| perf_nested_hyperv_storage_singledisk (lisa_0_47) | ⏭️ SKIPPED | 0.000 | check skipped: OS type mismatch: ["requires [<class 'lisa.operating_system.Windows'>] but VM supports [<class 'lisa.oper |
| perf_nested_kvm_storage_singledisk (lisa_0_45) | ✅ PASSED | 5464.278 | |
| perf_epoll (lisa_0_44) | ✅ PASSED | 186.827 | |
| perf_messaging (lisa_0_43) | ✅ PASSED | 1974.146 |
|
| Count | |
|---|---|
| ✅ Passed | 8 |
| ❌ Failed | 0 |
| ⏭️ Skipped | 1 |
| Total | 9 |
Test case details
| Test Case | Status | Time (s) | Message |
|---|---|---|---|
| perf_ultra_datadisks_1024k (lisa_0_1) | ✅ PASSED | 1062.961 | |
| perf_resource_disk_1024k (lisa_0_8) | ✅ PASSED | 1626.503 | |
| perf_premiumv2_datadisks_1024k (lisa_0_3) | ✅ PASSED | 2453.680 | |
| perf_premiumv2_datadisks_4k (lisa_0_2) | ✅ PASSED | 4369.093 | |
| perf_ultra_datadisks_4k (lisa_0_0) | ✅ PASSED | 4381.649 | |
| perf_nested_hyperv_storage_singledisk (lisa_0_47) | ⏭️ SKIPPED | 0.000 | check skipped: OS type mismatch: ["requires [<class 'lisa.operating_system.Windows'>] but VM supports [<class 'lisa.oper |
| perf_nested_kvm_storage_singledisk (lisa_0_45) | ✅ PASSED | 5471.373 | |
| perf_epoll (lisa_0_44) | ✅ PASSED | 187.134 | |
| perf_messaging (lisa_0_43) | ✅ PASSED | 1969.558 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results