Repository navigation
rpc: accept client-opened virtual disks via registered handle - #5196
Merged
Daman Mulye (damanm24) merged 1 commit intoNov 23, 2026
Merged
Conversation
Add DiskBackend.virtual_disk, which references a VHD or VHDX handle that the client opened with OpenVirtualDisk, attached for raw access and registered through the resource-passing protocol. OpenVMM wraps the handle as a VHDMP disk, so the image is accessed with the client's rights rather than OpenVMM's own, and I/O, discard and read-only handling match disks that OpenVMM opens by path. Virtual disks can back virtio-blk devices and NVMe namespaces, but not a VMGS or the lower disk of a memory diff overlay. VhdmpDisk rejects handles that are not attached for raw access with a specific error instead of a failed metadata query. A new VMM test passes a VHD handle to OpenVMM, exposes it to the guest over virtio-blk, and checks the disk size and the data written by both host and guest. The ttrpc VMM tests now share common pipette setup helpers.
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Reusing a registered handle across multiple disks creates independent I/O locks over the same Windows file object, allowing concurrent I/O to bypass required serialization.
1 open issue
What changed in this PR
Adds Windows RPC support for client-opened VHD/VHDX handles, allowing virtio-blk devices and NVMe namespaces to access images with the client’s rights.
Changes:
- Adds a registered-handle disk backend to the RPC schema and resource resolution.
- Wraps supplied handles as VHDMP disks and rejects unattached handles.
- Adds unit and integration coverage, shared test helpers, and documentation.
| File | Description |
|---|---|
vmm_tests/vmm_tests/tests/tests/ttrpc/handle_passing.rs |
Tests registered virtual-disk attachment and guest/host data visibility. |
vmm_tests/vmm_tests/tests/tests/ttrpc.rs |
Extracts shared boot, pipette, and device-wait helpers. |
vmm_tests/vmm_tests/Cargo.toml |
Adds the Windows VHDMP test dependency. |
vm/devices/storage/disk_vhdmp/src/lib.rs |
Supports externally opened handles and checks attachment state. |
openvmm/openvmm_ttrpc_vmservice/src/vmservice.proto |
Defines the virtual-disk backend and its usage contract. |
openvmm/openvmm_ttrpc_vmservice/src/resource_passing.md |
Documents the registered virtual-disk handle field. |
openvmm/openvmm_entry/src/ttrpc/mod.rs |
Resolves registered handles for storage devices and adds unit tests. |
openvmm/openvmm_entry/Cargo.toml |
Adds the Windows VHDMP runtime dependency. |
Guide/src/reference/openvmm/management/grpc.md |
Explains client-opened virtual disks through RPC. |
Cargo.lock |
Records the added VHDMP dependencies. |
Review effort: Balanced
| .resolve(handle_name) | ||
| .with_context(|| format!("failed to resolve virtual disk '{handle_name}'"))? | ||
| .into(); | ||
| Ok(disk_vhdmp::OpenVhdmpDiskConfig(disk_vhdmp::Vhd::from_file(file)).into_resource()) |
Will Wright (will-j-wright)
approved these changes
Nov 23, 2026
Daman Mulye (damanm24)
merged commit Nov 23, 2026
a1f7b8e
into
microsoft:main
108 of 109 checks passed
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.

This PR adds support for attaching a VHD or VHDX that the client has already opened to a VM through the ttrpc/gRPC interface on Windows, so the image is accessed with the client's rights rather than OpenVMM's.
Callers open the image with
OpenVirtualDisk, attach it for raw access, register the handle through the resource-passing protocol, and reference it by name withDiskBackend.virtual_disk.handle_name. OpenVMM wraps the handle as a VHDMP disk, so I/O, discard and read-only handling match disks that OpenVMM opens by path. Virtual disks can back virtio-blk devices and NVMe namespaces. Handles that are not attached for raw access are rejected with a specific error.