POC: Windows host & guest scaffolding — remove cygpath, add WINDOWS OS schema#4991
Draft
mn-ram wants to merge 1 commit into
Draft
POC: Windows host & guest scaffolding — remove cygpath, add WINDOWS OS schema#4991mn-ram wants to merge 1 commit into
mn-ram wants to merge 1 commit into
Conversation
037ad29 to
15d2f9d
Compare
2a74da4 to
e28e198
Compare
…S OS schema, experimental template Two complementary primary-goal contributions for the LFX 2026 Term 2 project "Improve Windows support (host and guest)" (lima-vm#4907): 1. Windows host UX Replaces the cygpath.exe subprocess at pkg/ioutilx/ioutilx.go:54 with deterministic pure-Go path translation. The implicit Cygwin / MSYS2 dependency is removed from Windows hosts. The public signature of WindowsSubsystemPath is unchanged, so all eight production callers (cmd/limactl/shell.go, pkg/copytool, pkg/hostagent/mount, pkg/sshutil x3, pkg/limayaml/defaults) continue to work without edits. - detectSubsystemStyle() picks one of {native, msys, cygwin} from MSYSTEM, CYGWIN, the SSH env var, and the resolved ssh binary path. Env vars win over heuristics so a user-asserted MSYSTEM is honored. - convertWindowsSubsystemPath() does the namespace remapping with pure string operations (no path/filepath calls), so the package builds and tests on any host. UNC paths pass through with slashes normalized, matching cygpath -u's behavior. - WindowsSubsystemPathForLinux on line 62 is intentionally left alone; it shells out to "wsl --exec wslpath", which is correct and not a Cygwin dependency. - 23 sub-tests cover style detection, drive-letter and UNC conversion, and the public end-to-end entry point. Uses gotest.tools/v3/assert per Lima's .golangci.yml. 2. Windows guest scaffolding Adds the schema groundwork any Windows-guest provisioning route needs: - WINDOWS OS = "Windows" added to pkg/limatype/lima_yaml.go and the OSTypes slice. NewOS() normalizes the lowercase "windows" alias the same way it does "linux" and "darwin". - pkg/limayaml/validate.go switch on *y.OS whitelists Windows. - TestValidateMultipleErrors updated to use "plan9" as the rejected OS (was using "windows" as the invalid example, which is now valid) and refreshed the expected OSTypes message. - TestValidateWindowsGuestOS added — positive + negative cases. - templates/experimental/windows.yaml — minimal QEMU-driven Windows guest template. Image URL is intentionally a 404 placeholder so the template is reviewable for its schema shape without misleading anyone into thinking limactl start is functional yet; the file header documents the follow-up work in pkg/cidata and pkg/driver/qemu. A self-contained Go module under poc/ prototypes the conversion logic in isolation and is kept in the tree as a runnable demo (go run ./poc/cmd/winpath-demo 'C:\...'). It is not required by the production code path and maintainers may strip it before merge. Out of scope, deferred to follow-up PRs and documented in the project plan: pkg/cidata branching for Cloudbase-Init data, QEMU TPM/UEFI plumbing for Windows guests, pkg/driver/hcs external driver, WSL2 multi-instance + WSLg, limactl doctor for the first- run Windows wizard. Signed-off-by: mn-ram <235066282+mn-ram@users.noreply.github.com>
e28e198 to
2b2e22c
Compare
Member
Member
|
Note that Windows host implementation is likely already solved by #4998 in a much more comprehensive way, so I would not spend any further effort on it, and concentrate on the Windows guest support instead. |
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.
Summary
Two complementary primary-goal contributions for the LFX 2026 Term 2 project Improve Windows support (host and guest) (#4907):
cygpath.exeshell-out inpkg/ioutilx/ioutilx.goreplaced with deterministic pure-Go path translation. All eight production callers continue to work; the implicit Cygwin/MSYS2 dependency is removed from Windows hosts.WINDOWS OS = "Windows"added to the schema (pkg/limatype,pkg/limayaml/validate.go), plustemplates/experimental/windows.yaml. This is the shared groundwork that any Windows-guest provisioning route (Cloudbase-Init or autounattend.xml) needs.Both are signature-preserving / additive: every existing caller compiles unchanged, every existing template still validates.
What's in the diff
pkg/ioutilx/ioutilx.go,pkg/ioutilx/ioutilx_test.goWindowsSubsystemPathsignature unchanged; cygpath subprocess removed; 23 sub-testspkg/limatype/lima_yaml.go,pkg/limayaml/validate.go,pkg/limayaml/validate_test.goWINDOWS OS = "Windows";NewOSnormalizes lowercase alias; positive + negative validator teststemplates/experimental/windows.yamlpoc/Verification
go build ./...cleango vet ./...cleango test ./pkg/ioutilx/ ./pkg/limayaml/ ./pkg/limatype/— all green (23 new sub-tests in ioutilx, 4 new sub-tests in limayaml)WindowsSubsystemPathstill compile (cmd/limactl/shell.go,pkg/copytool,pkg/hostagent/mount,pkg/sshutil× 3,pkg/limayaml/defaults)cygpathshell-out in the production treevalidate_test.gotests still pass after the OS list changeCygpath conversion table
C:\Users\me\.lima→nativeC:\Windows\System32\OpenSSHC:/Users/me/.limamsysMSYSTEMset, or ssh under Git-for-Windows/c/Users/me/.limacygwinCYGWINset, or ssh undercygwin64/cygdrive/c/Users/me/.limaUNC paths pass through with slashes normalized, matching
cygpath -u's behavior.WindowsSubsystemPathForLinuxon line 62 is intentionally left alone — it shells out towsl --exec wslpath, which is not a Cygwin dependency.Scope not in this PR
Documented as next steps in the project plan, intentionally left for follow-up:
pkg/cidatabranching onguestOS == Windowsto emit Cloudbase-Init NoCloud data or autounattend.xml ISOs (mentor's choice).pkg/driver/qemuTPM 2.0 + UEFI plumbing whenos: Windows.pkg/driver/hcsexternal driver against Microsofthcsshim(secondary goal).limactl doctorfor Windows-host first-run wizard.poc/sandbox directory — keep for now as a runnable demo; maintainers may strip before merge.Status
Draft for LFX mentorship visibility. Happy to split into separate PRs or drop the
poc/sandbox if preferred.