-
Notifications
You must be signed in to change notification settings - Fork 625
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
feat: add WSL2 driver #1721
feat: add WSL2 driver #1721
Conversation
@pendo324 : thank you for your contribution, it would be have been good to open an issue for discussion about the feature itself and keep the PR for the implementation - but that can be done afterwards too, and reference this PR Running Lima in a container is slightly different from all the other drivers, so it might need some thought (Lima itself has some similaries to WSL2). I agree that a more traditional HyperV driver would also be a nice addition, like "VZ"... |
cmd/limactl/delete.go
Outdated
@@ -53,9 +55,16 @@ func deleteInstance(inst *store.Instance, force bool) error { | |||
|
|||
stopInstanceForcibly(inst) | |||
|
|||
if inst.VMType == limayaml.WSL { | |||
if _, err := executil.RunUTF16leCommand([]string{"wsl", "--unregister", inst.DistroName}); err != nil { |
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.
Can we just limit it to ASCII?
I'll create an issue to track Windows support in general, and weigh the different options (WSL2, HyperV, qemu, etc.) as I do think there are reasons you might want to use one over the other. I wanted to come to the project with some code instead of just an issue, but it ballooned into a lot of code before I knew it 😅 |
bdc225f
to
4101c78
Compare
6e1d9aa
to
5698ac5
Compare
Addressed comments and rebased. Also added documentation. Would be good to merge #1726 first since it's just extracted from @afbjorklund PR. I can just squash it into this PR if that's preferable though. |
5d7c1f5
to
5af4f8f
Compare
Another one is that WSL2 is supported in Windows Home whereas Hyper-V requires at least Windows Pro. This is purely a licensing issue as WSL2 is running on top of Hyper-V. |
4cb22a6
to
f01d311
Compare
Not sure why the tests are failing, but it doesn't seem related. Should I keep retrying @AkihiroSuda? |
CI for Colima seems consistently failing after restarting several times. Maybe a regression in this PR? |
Found the bug (typo) and fixed it (tests passed locally). Should be good to go after CI passes |
docs/vmtype.md
Outdated
> **Warning** | ||
> "wsl2" mode is experimental | ||
|
||
| :zap: Requirement | Lima >= 0.14, macOS >= 13.0 | |
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.
Seems a copy paste error
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.
Thanks, fixed in latest revision
Thanks, almost looks good, but needs rebase |
Signed-off-by: Justin Alvarez <[email protected]>
Thanks. Just rebased and addressed your new comment |
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.
Thanks
Looks like the tests failed/timed out on |
Couldn't repro test error locally:
Is it possible to re-run the step? |
Restarted CI, all green |
PTAL: |
This PR users WSL2 to add a new VM Driver for Windows. This addresses the longstanding GitHub issue asking for Windows support (#391).
The traditional thinking (as seen in #909) is to make QEMU work on Windows, and the addition of a WSL2 driver should not inhibit that effort, just provide another option (I'd also like to see a direct HyperV option 👀 ).
Considerations:
127.0.0.1:<Instance.SSHLocalPort>
, although this is possible through the use of netsh (I couldn't get ssh port forwarding to work). Currently, the PR just uses the WSL2 instance's IP address and port 22. I can add some netsh calling code to get this working relatively easily, I just wanted to know if that's requiredssh
binary on Windows, which isn't common. My recommendation is to have users install Git for Windows (specifically the MinGit release), which comes with some other helpful utilities likecygpath
. Bundling this with Lima or just requiring users to runwinget install -e --id Git.MinGit
(winget is now built into Windows) and adding it to path are both possible. The version of OpenSSH installable as a Windows optional feature is pretty old. Open to suggestions incase I missed something.sleep
command. Open to suggestions here, as I'm sure there are better ways to do this