Skip to content

Add Hyper-V device passthrough validation and recovery#4506

Open
vyadavmsft wants to merge 4 commits into
mainfrom
users/vyadav/hyperv-passthrough-tests
Open

Add Hyper-V device passthrough validation and recovery#4506
vyadavmsft wants to merge 4 commits into
mainfrom
users/vyadav/hyperv-passthrough-tests

Conversation

@vyadavmsft
Copy link
Copy Markdown
Collaborator

@vyadavmsft vyadavmsft commented May 31, 2026

Description

  • Add functional validation for passthrough devices on the guest.
  • Add Hyper-V passthrough network performance coverage for host-to-guest NTTTCP scenarios.
  • Add Windows NTTTCP setup, execution, and result parsing support.
  • Improve reboot handling used by passthrough workflows.
  • Roll back Hyper-V DDA device assignments when assignment fails.
  • Add selftests for Hyper-V device pool rollback behavior.

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:

Impacted LISA Features:

Tested Azure Marketplace Images:

Test Results

Image VM Size Result
PASSED / FAILED / SKIPPED

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.
Copilot AI review requested due to automatic review settings May 31, 2026 23:49
@vyadavmsft vyadavmsft force-pushed the users/vyadav/hyperv-passthrough-tests branch from e3605cc to 5ab1f7c Compare May 31, 2026 23:50
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.
@github-actions
Copy link
Copy Markdown

⏭️ AI Test Selection — SKIPPED

53 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Selected test cases
perf_nested_kvm_storage_singledisk
perf_nested_kvm_storage_multidisk
perf_nested_hyperv_storage_singledisk
perf_nested_hyperv_storage_multidisk
perf_nested_kvm_ntttcp_private_bridge
perf_nested_kvm_ntttcp_different_l1_nat
perf_nested_hyperv_ntttcp_different_l1_nat
perf_nested_kvm_netperf_pps_nat
perf_tcp_latency_synthetic
perf_tcp_latency_sriov
perf_tcp_single_pps_synthetic
perf_tcp_single_pps_sriov
perf_tcp_max_pps_synthetic
perf_tcp_max_pps_sriov
perf_tcp_ntttcp_128_connections_synthetic
perf_tcp_ntttcp_synthetic
perf_tcp_ntttcp_sriov
perf_udp_1k_ntttcp_synthetic
perf_udp_1k_ntttcp_sriov
perf_tcp_iperf_synthetic
perf_tcp_iperf_sriov
perf_udp_iperf_synthetic
perf_udp_iperf_sriov
perf_sockperf_latency_tcp_sriov
perf_sockperf_latency_udp_sriov
perf_sockperf_latency_udp_synthetic
perf_sockperf_latency_tcp_synthetic
perf_sockperf_latency_tcp_sriov_busy_poll
perf_sockperf_latency_udp_sriov_busy_poll
perf_sockperf_latency_udp_synthetic_busy_poll
perf_sockperf_latency_tcp_synthetic_busy_poll
perf_nvme
perf_nvme_io_uring
perf_messaging
perf_epoll
perf_ultra_datadisks_4k
perf_ultra_datadisks_1024k
perf_premiumv2_datadisks_4k
perf_premiumv2_datadisks_1024k
perf_premium_datadisks_4k
perf_premium_datadisks_1024k
perf_premium_datadisks_4k_io_uring
perf_premium_datadisks_1024k_io_uring
perf_resource_disk_1024k
perf_resource_disk_4k
perf_standardssd_datadisks_4k
perf_standardssd_datadisks_1024k
perf_premium_datadisks_io
perf_storage_over_nfs_sriov_tcp_4k
perf_storage_over_nfs_sriov_udp_4k
perf_storage_over_nfs_synthetic_tcp_4k
perf_storage_over_nfs_synthetic_udp_4k
perf_storage_generic_fio_test

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

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 reboot and 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 thread lisa/tools/reboot.py
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 thread lisa/tools/ntttcp.py
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:
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

⚠️ AI Test Selection — cancelled

53 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

⚠️ AI Test Selection — cancelled

53 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

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

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