Skip to content

[WIP] vhdx: add pure-Rust VHDX parser and disk layer#3347

Draft
jstarks wants to merge 1 commit intomicrosoft:mainfrom
jstarks:vhdx
Draft

[WIP] vhdx: add pure-Rust VHDX parser and disk layer#3347
jstarks wants to merge 1 commit intomicrosoft:mainfrom
jstarks:vhdx

Conversation

@jstarks
Copy link
Copy Markdown
Member

@jstarks jstarks commented Apr 21, 2026

Add a pure-Rust VHDX implementation with full read/write support, write-ahead logging, crash consistency, free space management, trim, differencing disk chains, and a disk_backend integration layer.

This allows non-Windows hosts to use VHDX files.

Copilot AI review requested due to automatic review settings April 21, 2026 20:26
Comment thread openvmm/openvmm_helpers/src/disk.rs Outdated
@github-actions github-actions Bot added the unsafe Related to unsafe code label Apr 21, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Comment thread vm/devices/storage/disklayer_vhdx/src/chain.rs Outdated
Comment thread vm/devices/storage/disklayer_vhdx/src/chain.rs Outdated
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a cross-platform, pure-Rust VHDX implementation (parser + read/write + WAL pipeline) and wires it into OpenVMM’s layered disk stack so .vhdx works without the Windows-only kernel driver.

Changes:

  • Introduces a new vhdx crate with VHDX format parsing, metadata/region/header handling, and a WAL-backed commit/apply pipeline.
  • Adds a new disklayer_vhdx crate implementing LayerIo + resolver, including parent-locator chain walking.
  • Updates OpenVMM resource registration and disk-opening logic to use the new VHDX backend for .vhdx.

Reviewed changes

Copilot reviewed 34 out of 41 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
vm/devices/storage/vhdx/src/sector_bitmap.rs Sector bitmap cache + partially-present read resolution; adds unit tests.
vm/devices/storage/vhdx/src/region.rs Region table parsing/validation + rewrite via WAL; adds tests.
vm/devices/storage/vhdx/src/metadata.rs Metadata table parsing + item reads; adds tests.
vm/devices/storage/vhdx/src/lsn_watermark.rs Async LSN/FSN watermark primitive with poisoning + tests.
vm/devices/storage/vhdx/src/log_task.rs WAL logging task plumbing and tail advancement + tests.
vm/devices/storage/vhdx/src/log_permits.rs Failable semaphore for pipeline backpressure + tests.
vm/devices/storage/vhdx/src/locator.rs Parent locator parsing (UTF-16 KV table) + tests.
vm/devices/storage/vhdx/src/lib.rs Crate root + module exports + AsyncFile trait.
vm/devices/storage/vhdx/src/known_meta.rs Parses well-known metadata items + required-item validation + tests.
vm/devices/storage/vhdx/src/header.rs Dual-header parsing + serialized header updates + tests.
vm/devices/storage/vhdx/src/format.rs On-disk structs/constants + checksums + GUIDs + layout tests.
vm/devices/storage/vhdx/src/flush.rs Flush sequencer implementation + tests.
vm/devices/storage/vhdx/src/error.rs Error and corruption enums used across the crate.
vm/devices/storage/vhdx/src/create.rs VHDX creation logic (headers/regions/metadata/BAT) + tests.
vm/devices/storage/vhdx/src/apply_task.rs Apply task writing logged pages to final offsets.
vm/devices/storage/vhdx/Cargo.toml Defines the new vhdx crate and dependencies.
vm/devices/storage/disklayer_vhdx/src/resolver.rs Resource resolver for VhdxDiskLayerHandle.
vm/devices/storage/disklayer_vhdx/src/lib.rs LayerIo implementation bridging vhdx ranges to buffers.
vm/devices/storage/disklayer_vhdx/src/io.rs BlockingFile implementing vhdx::AsyncFile via blocking pool.
vm/devices/storage/disklayer_vhdx/src/chain.rs Helpers to open single VHDX or auto-walk differencing chains.
vm/devices/storage/disklayer_vhdx/Cargo.toml Defines the new disklayer crate + deps/tests.
vm/devices/storage/disk_backend_resources/src/layer.rs Adds VhdxDiskLayerHandle resource type.
openvmm/openvmm_resources/src/lib.rs Registers the new VHDX disklayer resolver.
openvmm/openvmm_resources/Cargo.toml Adds disklayer_vhdx dependency.
openvmm/openvmm_helpers/src/disk.rs Routes .vhdx open to the pure-Rust VHDX chain implementation.
openvmm/openvmm_helpers/Cargo.toml Adds disklayer_vhdx dependency.
Cargo.toml Adds workspace members + crc32c dependency.

Comment thread vm/devices/storage/vhdx/src/metadata.rs Outdated
Comment thread vm/devices/storage/vhdx/src/lsn_watermark.rs Outdated
Comment thread vm/devices/storage/vhdx/src/lsn_watermark.rs Outdated
Comment thread vm/devices/storage/vhdx/src/log_permits.rs Outdated
Comment thread vm/devices/storage/vhdx/src/log_task.rs Outdated
Comment thread vm/devices/storage/vhdx/src/format.rs Outdated
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs Outdated
Comment thread vm/devices/storage/vhdx/src/lsn_watermark.rs
Comment thread vm/devices/storage/disklayer_vhdx/src/io.rs
Comment thread openvmm/openvmm_helpers/src/disk.rs
@jstarks jstarks requested a review from Copilot April 21, 2026 21:07
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

Copilot reviewed 34 out of 41 changed files in this pull request and generated 7 comments.

Comment thread vm/devices/storage/vhdx/src/flush.rs Outdated
Comment thread vm/devices/storage/vhdx/src/apply_task.rs Outdated
Comment thread vm/devices/storage/vhdx/src/region.rs Outdated
Comment thread vm/devices/storage/vhdx/src/metadata.rs
Comment thread vm/devices/storage/vhdx/src/locator.rs Outdated
Comment thread vm/devices/storage/disklayer_vhdx/src/lib.rs Outdated
Comment thread openvmm/openvmm_helpers/src/disk.rs
Copilot AI review requested due to automatic review settings April 22, 2026 04:39
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

Copilot reviewed 34 out of 41 changed files in this pull request and generated 6 comments.

Comment thread vm/devices/storage/vhdx/src/apply_task.rs
Comment thread vm/devices/storage/vhdx/src/log_task.rs
Comment thread vm/devices/storage/disklayer_vhdx/src/lib.rs Outdated
Comment thread vm/devices/storage/vhdx/src/io.rs Outdated
Comment thread openvmm/openvmm_helpers/src/disk.rs
Comment thread vm/devices/storage/vhdx/src/flush.rs
Copilot AI review requested due to automatic review settings April 22, 2026 05:16
@github-actions github-actions Bot added the Guide label Apr 22, 2026
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

Copilot reviewed 40 out of 47 changed files in this pull request and generated 9 comments.

Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/disklayer_vhdx/src/chain.rs
Comment thread vm/devices/storage/disklayer_vhdx/src/lib.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread Guide/src/user_guide/openvmm/run.md
Copilot AI review requested due to automatic review settings April 22, 2026 06:13
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

Copilot reviewed 40 out of 47 changed files in this pull request and generated 6 comments.

Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/flush.rs Outdated
Comment thread vm/devices/storage/disklayer_vhdx/src/lib.rs Outdated
Comment thread vm/devices/storage/disklayer_vhdx/src/lib.rs Outdated
Comment thread Guide/src/reference/backends/vhdx.md Outdated
Comment thread Guide/src/user_guide/openvmm/run.md Outdated
@jstarks jstarks requested a review from Copilot April 27, 2026 15:15
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

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

Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/sector_bitmap.rs
Comment thread vm/devices/storage/vhdx/src/header.rs Outdated
Comment thread vm/devices/storage/vhdx/src/metadata.rs Outdated
Comment thread vm/devices/storage/vhdx/src/region.rs Outdated
Copilot AI review requested due to automatic review settings April 27, 2026 19:53
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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

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

Labels

Guide unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants