Skip to content

Introduce virtual machine backend interface - #41663

Open
Daman Mulye (damanm24) wants to merge 6 commits into
feature/openvmmfrom
user/damanmulye/virtualmachinebackend
Open

Daman Mulye (damanm24) wants to merge 6 commits into
feature/openvmmfrom
user/damanmulye/virtualmachinebackend

Conversation

@damanm24

Copy link
Copy Markdown
Contributor

This PR introduces a new IVirtualMachineBackend that will be used by both WSL/WSLC to manage VMs that back their sessions. It also introduces a new OpenVmmVirtualMachineBackend class that provides a concrete implementation of the interface that can boot a minimal Linux VM. The long-term goal is to complete the OpenVmmVirtualMachineBackend implementation and provide a corresponding HcsVirtualMachineBackend implementation that both WSL and WSLC can use. Currently, the classes responsible for managing VMs for these two areas (WslCoreVm for WSL and WSLCVirtualMachine) have their product specific logic coupled with managing VMs. Eventually these classes will be refactored to split these two areas and provide better separation and single responsibility.

Copilot AI lite review requested due to automatic review settings September 21, 2026 18:24
@damanm24
Daman Mulye (damanm24) requested a review from a team as a code owner September 21, 2026 18:24

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.

Copilot review overview

🟡 Changes recommended

The backend’s advertised capabilities currently conflict with what the implementation actually supports (notably firmware boot and several unimplemented operations), which can mislead capability-driven callers.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

This PR introduces a new IVirtualMachineBackend abstraction in the Windows service layer, plus an initial OpenVmmVirtualMachineBackend implementation intended to become a shared VM-management layer for both WSL and WSLC.

Changes:

  • Added IVirtualMachineBackend API surface and factory helpers for selecting/querying a backend.
  • Implemented an initial OpenVMM-backed VM backend with request validation, process lifecycle, and basic disk attach/detach.
  • Added Windows tests and build/package wiring to bring in OpenVMM binaries and required boot artifacts.
File Description
test/​windows/​OpenVmmVirtualMachineBackendTests.cpp Adds validation, lifecycle, and capability tests for the OpenVMM backend.
test/​windows/​CMakeLists.txt Wires the new test into wsltests and stages the kernel dependency.
src/​windows/​service/​exe/​VirtualMachineBackend.cpp Adds factory functions to create/query a backend by BackendKind.
src/​windows/​service/​exe/​OpenVmmVirtualMachineBackend.h Declares the OpenVMM backend implementation of IVirtualMachineBackend.
src/​windows/​service/​exe/​OpenVmmVirtualMachineBackend.cpp Implements OpenVMM VM creation/teardown, request validation, and disk attach/detach plumbing.
src/​windows/​service/​exe/​IVirtualMachineBackend.h Introduces the cross-backend interface and shared request/description types.
src/​windows/​service/​exe/​CMakeLists.txt Adds the virtualmachinebackend static lib and links it into wslservice.
packages.config Adds the Microsoft.WSL.OpenVMM NuGet dependency.
msipackage/​package.wix.in Adds openvmm.exe and wslopenvmm.dll to the MSI payload.
msipackage/​CMakeLists.txt Includes OpenVMM binaries in the packaging input list.
CMakeLists.txt Locates the OpenVMM package and wires an imported client library plus binary staging into bin/.
.pipelines/​wsl-build-pr.yml Expands PR build trigger patterns to include feature/* branches.

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

Comment thread src/windows/service/exe/OpenVmmVirtualMachineBackend.cpp
Comment thread src/windows/service/exe/OpenVmmVirtualMachineBackend.cpp
…to user/damanmulye/virtualmachinebackend
Copilot AI review requested due to automatic review settings September 21, 2026 21:08
@damanm24
Daman Mulye (damanm24) requested a review from a team as a code owner September 21, 2026 21:08

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.

Copilot review overview

🟡 Changes recommended

It introduces contract/build reliability issues (capabilities advertising unimplemented operations and tests/build steps depending on unguarded external kernel artifacts) that can cause runtime failures or broken builds.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity · 1 Low severity

Open (4)
Resolved since last review (2)

Comment thread src/windows/service/exe/IVirtualMachineBackend.h
Comment thread test/windows/CMakeLists.txt
Comment thread test/windows/OpenVmmVirtualMachineBackendTests.cpp
Comment thread test/windows/OpenVmmVirtualMachineBackendTests.cpp
Copilot AI review requested due to automatic review settings September 21, 2026 21:16

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.

Copilot review overview

🟡 Changes recommended

It introduces build/runtime inconsistencies (OpenVMM binaries no longer placed in the base path expected by the new backend/tests) and advertises a capability (UpdateNetworkAdapter) that has no corresponding interface method.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 3 Medium severity · 1 Low severity

Open (5)

Comment thread CMakeLists.txt

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.

Copilot review overview

🟡 Changes recommended

Socket cleanup can leak VM directories, and the new test file fails the repository copyright validation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
Resolved since last review (4)

Comment thread src/windows/service/exe/OpenVmmVirtualMachineBackend.cpp Outdated
Comment thread test/windows/OpenVmmVirtualMachineBackendTests.cpp
Replaced file deletion with recursive directory removal for improved error handling.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 21, 2026 22:17

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.

Copilot review overview

🔵 Needs a closer look

ARM64 capabilities contradict creation support, and runtime disk operations lack coverage.

Review effort: Balanced
Findings: None

Resolved since last review (3)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Fix ARM64 capability expectation for unsupported create requests

test/​windows/​OpenVmmVirtualMachineBackendTests.cpp:215

This expectation is incorrect on ARM64: ValidateCreateRequest() unconditionally rejects every create request there, but this unskipped test requires LinuxDirectBoot to be advertised. A capability-driven caller can therefore select OpenVMM on ARM64 even though creation is guaranteed to fail. Make the queried capabilities platform-aware and update this expectation accordingly.

Low severity Add integration coverage for runtime disk attach and detach

src/​windows/​service/​exe/​OpenVmmVirtualMachineBackend.cpp:549

The new runtime disk path is untested. Existing disk tests only exercise ValidateCreateRequest() for boot disks, so regressions in the C ABI attach call, ID/LUN allocation, rollback, and DetachDisk() bookkeeping would not be detected. Add an integration test that boots a VM, attaches a test VHD, validates the returned attachment, and detaches it (including an explicit-placement or duplicate-LUN case).

This branch has not been deployed

No deployments
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.

2 participants