Skip to content

[AI Generated] Add Hyper-V host VHD runbook - #4722

Open
LiliDeng wants to merge 1 commit into
mainfrom
feature/hyperv-host-vhd-runbook
Open

LiliDeng wants to merge 1 commit into
mainfrom
feature/hyperv-host-vhd-runbook

Conversation

@LiliDeng

Copy link
Copy Markdown
Collaborator

Summary

  • Add a reusable Hyper-V host VHD/VHDX runbook.
  • Skip guest partition expansion unless LISA actually expands the VHD.
  • Document Hyper-V host prerequisites, usage, and troubleshooting.

Validation

  • Loaded the runbook and confirmed it selects Provisioning.smoke_test.
  • Validated YAML and whitespace checks.

AI-generated change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Unresolved switch-selection/NAT behavior and unescaped VHD paths can prevent documented flows from working.

Pull request overview

Adds a reusable Hyper-V host VHD/VHDX runbook with conditional partition expansion and supporting documentation.

Changes:

  • Expands guest partitions only when LISA resizes the VHD.
  • Adds configurable Hyper-V host VHD runbook settings.
  • Documents Hyper-V prerequisites, usage, and troubleshooting.
File summaries
File Summary
lisa/sut_orchestrator/hyperv/platform_.py Conditionally expands guest partitions after VHD resizing.
lisa/microsoft/runbook/hyperv/host_vhd.yml Adds the host VHD runbook; switch selection/NAT handling and VHD path quoting require changes.
docs/run_test/run.rst Adds Hyper-V documentation navigation.
docs/run_test/hyperv.rst Documents setup and usage; switch override behavior requires correction.
Review details

Suppressed comments (3)

docs/run_test/hyperv.rst:89

  • The documented switch_name override can select an internal switch, but the Hyper-V platform decides whether to use NAT from default_switch.type, not from the selected switch. When an external switch exists and this variable selects an internal switch, LISA passes the guest's internal IP directly to the controller, so the smoke test cannot connect; cleanup has the same default-switch assumption. Please make the platform track the selected switch type (including cleanup), or restrict this runbook/documentation to the default switch behavior.
``switch_name``
  Optional Hyper-V virtual switch. If omitted, LISA uses the host default switch.

lisa/microsoft/runbook/hyperv/host_vhd.yml:73

  • guest_vhd_path is documented as an arbitrary path on the Windows host, but _resize_vhd_if_needed interpolates it into Get-VHD -Path and Resize-VHD -Path without quoting or escaping. A valid path such as C:\VM Images\guest.vhdx will therefore fail during Get-VHD even when osdisk_size_in_gb is 0, because that query runs unconditionally. Quote/escape the path when constructing the PowerShell cmdlets.
          vhd_path: $(guest_vhd_path)

lisa/microsoft/runbook/hyperv/host_vhd.yml:75

  • This runbook allows selecting an external switch, but the Hyper-V deployment path decides whether to add NAT by inspecting the host's default_switch, not the selected switch_name. On a host whose default switch is internal, selecting an external switch still rewrites the guest address to the host address and uses a NAT port, so the documented external-switch flow cannot connect to the guest. Base the NAT branch on the selected switch (or otherwise carry its type) before relying on this option.
      switch_name: $(switch_name)
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@LiliDeng

Copy link
Copy Markdown
Collaborator Author

AI Test Case Selection

Selected 1 test case(s): smoke_test

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

Result: Succeeded

View full logs in Azure DevOps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants