-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix edge cases around .vhd support #13061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Considering adding some tests, need to convert some vhdx to vhd. |
29798aa
to
6373f25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good. Regarding test coverage, looks like https://learn.microsoft.com/en-us/powershell/module/hyper-v/convert-vhd?view=windowsserver2025-ps can convert from vhdx to vhd
963ddba
to
ca0729a
Compare
Done. |
ca0729a
to
1b2a143
Compare
9c544b0
to
7d86240
Compare
There was a problem hiding this 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 improves VHD (Virtual Hard Disk) support in WSL by fixing edge cases and clarifying that both .vhd and .vhdx file formats are supported. The changes address issues discovered while testing the --fixed-vhd
feature.
Key Changes
- Updated error messages and documentation to reflect support for both .vhd and .vhdx file extensions
- Added validation logic to prevent export/import of VHD files to/from stdin/stdout
- Implemented dynamic VHD filename handling in move and registration operations to preserve file extensions
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/windows/common/wslutil.h | Added new IsVhdFile() helper function declaration |
src/windows/common/wslutil.cpp | Implemented IsVhdFile() to check for both .vhd and .vhdx extensions |
src/windows/common/WslClient.cpp | Removed client-side file extension validation (moved to service) |
src/windows/service/exe/LxssUserSession.cpp | Added service-side validation for VHD export/import operations and dynamic filename handling |
src/windows/service/exe/WslCoreFilesystem.cpp | Simplified assertion to use new IsVhdFile() helper |
localization/strings/en-US/Resources.resw | Updated error messages and help text to clarify .vhd/.vhdx support |
test/windows/UnitTests.cpp | Updated test assertions and added comprehensive ExportImportVhd test |
test/windows/SimpleTests.cpp | Updated test assertions for consistency |
Co-authored-by: Copilot <[email protected]>
While experimenting with the new --fixed-vhd support I realized we do not correctly handle all cases where a distro might be stored as a .vhd. This resolves those issues and clarifies usage that we support both .vhd and .vhdx.