Skip to content

Conversation

@tjones60
Copy link
Contributor

Add a few basic Hyper-V OpenHCL PCAT tests using the new disk management infrastructure added in #2551

Will rebase once the previous PR merges

@tjones60 tjones60 requested a review from a team as a code owner December 20, 2025 07:08
Copilot AI review requested due to automatic review settings December 20, 2025 07:08
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

This PR adds Hyper-V OpenHCL PCAT tests by introducing new disk management infrastructure. The changes refactor how boot devices and storage controllers are handled across the test framework.

  • Introduces OpenhclPcat firmware type and new boot device types (e.g., IdeViaScsi, ScsiViaNvme)
  • Refactors storage configuration from imperative with_custom_vtl2_settings to declarative add_vtl2_storage_controller API
  • Adds comprehensive disk and storage controller management types (Drive, Disk, VmbusStorageController)
  • Implements Hyper-V backend storage APIs with new PowerShell cmdlets for drive management

Reviewed changes

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

Show a summary per file
File Description
vmm_tests/vmm_tests/tests/tests/x86_64/storage.rs Refactored to use new add_vtl2_storage_controller API instead of with_custom_vtl2_settings
vmm_tests/vmm_tests/tests/tests/x86_64/openhcl_uefi.rs Removed [nvme] annotation, added explicit with_boot_device_type calls
vmm_tests/vmm_tests/tests/tests/x86_64/openhcl_linux_direct.rs Updated to use new storage controller API
vmm_tests/vmm_tests/tests/tests/multiarch/openhcl_servicing.rs Updated to use new storage controller API and boot device type
vmm_tests/vmm_tests/tests/tests/multiarch.rs Added three new hyperv_openhcl_pcat_x64 test configurations
vmm_tests/vmm_test_macros/src/lib.rs Added OpenhclPcat firmware variant, removed nvme option from OpenhclUefiOptions
petri/src/vm/vtl2_settings.rs Added channel field to Vtl2LunBuilder for IDE controller support
petri/src/vm/openvmm/start.rs Simplified by moving boot disk and storage logic to construction phase
petri/src/vm/openvmm/runtime.rs Added stub set_vmbus_drive method
petri/src/vm/openvmm/modify.rs Updated to use new PetriVmProperties
petri/src/vm/openvmm/mod.rs Removed boot device constants, added petri_disk_to_openvmm helper
petri/src/vm/openvmm/construct.rs Major refactoring: added IDE and VMBus storage handling, removed old boot disk logic
petri/src/vm/mod.rs Added core types (PetriVmProperties, VmbusStorageController, Drive, Disk), new boot device types, storage management methods
petri/src/vm/hyperv/vm.rs Refactored storage APIs to use VSID instead of controller numbers
petri/src/vm/hyperv/powershell.rs Added PowerShell functions for storage controller and drive management
petri/src/vm/hyperv/mod.rs Simplified backend, added storage controller iteration, removed HyperVPetriConfig
petri/src/vm/hyperv/hyperv.psm1 Added comprehensive PowerShell cmdlets for SCSI/IDE drive management using WMI
petri/src/tracing.rs Added Debug derives
petri/src/disk_image.rs Added ImageType parameter to build() method to support VHD output
petri/petri-tool/src/main.rs Updated to pass ImageType::Raw to build()

@github-actions
Copy link

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

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

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

Comment on lines +516 to +522
if ($ControllerVsid) {
$controller = $Vm | Get-VmScsiControllerWithId -Vsid $ControllerVsid
$controllerId = $controller.VirtualSystemIdentifiers[0]
} else {
$controller = $Vm | Get-VmIdeController -ControllerNumber $ControllerNumber
$controllerId = $controller.Address
}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

In the PowerShell Set-VmDrive function, when $ControllerVsid is specified, the controller type should be checked to ensure it's a SCSI controller. IDE controllers use ControllerNumber not Vsid. The current code path could fail silently or produce unexpected behavior if called incorrectly.

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +84
HyperVGuestStateIsolationType::Disabled => "-1",
HyperVGuestStateIsolationType::TrustedLaunch => "0",
HyperVGuestStateIsolationType::Vbs => "1",
HyperVGuestStateIsolationType::Snp => "2",
HyperVGuestStateIsolationType::Tdx => "3",
HyperVGuestStateIsolationType::OpenHCL => "16",
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The AsVal implementation for HyperVGuestStateIsolationType is returning string representations of numbers instead of the enum names. This changes the interface from string-based to integer-based, which could be a breaking change if any PowerShell code expects the original string values like "TrustedLaunch" or "VBS".

Suggested change
HyperVGuestStateIsolationType::Disabled => "-1",
HyperVGuestStateIsolationType::TrustedLaunch => "0",
HyperVGuestStateIsolationType::Vbs => "1",
HyperVGuestStateIsolationType::Snp => "2",
HyperVGuestStateIsolationType::Tdx => "3",
HyperVGuestStateIsolationType::OpenHCL => "16",
HyperVGuestStateIsolationType::Disabled => "Disabled",
HyperVGuestStateIsolationType::TrustedLaunch => "TrustedLaunch",
HyperVGuestStateIsolationType::Vbs => "VBS",
HyperVGuestStateIsolationType::Snp => "SNP",
HyperVGuestStateIsolationType::Tdx => "TDX",
HyperVGuestStateIsolationType::OpenHCL => "OpenHCL",

Copilot uses AI. Check for mistakes.
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.

2 participants