Use the WSL convention for the windows machines default volumes#2100
Conversation
Luap99
left a comment
There was a problem hiding this comment.
This is likely the right thing but it also a breaking change as hyper V users might depend on the current paths and I am not sure how we could deal with that.
This is very true but volumes, with the default mount config, were kind of broken on Hyper-V. For example: fails to start. So I am wondering, how many podman users are using Hyper-V with the default mount config? Not a lot I guess. But the more we wait there more there will be. And for those that have a custom mount config (as suggested in the issue for example), this PR doesn't affect them. |
But this should work with the current default I assume? And if we have users using that we break them. I mean overall the number of hyperV users is most likely very small compared to WSL so maybe it is the right thing to do it now to make the volume behaviour consistent and just let people deal with it. Although is there any way we can make it backwards compatible? Maybe we could add two mounts |
Yes you are correct. That works and users that use that will get broken
I have tested adding both mount configs ( That's not an obvious choice. Do we want to force users to move to a consistent volume format or should we keep maintaining the support for those two inconsistent formats on windows? Considered that Hyper-V is still not widely used I would lean towards the first option. But I am happy to update the PR if the consensus is for the second option. @n1hility @baude what's your opinion on that? |
|
I have pushed a commit with the alternative approach (keeping the old hyper-v default mount and adding a new WSL-consistent mount) to this branch l0rd@2dfaccc. |
|
I think its fine to keep support for both formats you can always deprecate one and remove the code later. |
jeffmaury
left a comment
There was a problem hiding this comment.
Shouldn't we scan all local drives (C: D: ...) ?
|
im ok with the option to support both ... |
0f3ba1a to
0282f33
Compare
|
@n1hility @baude @Luap99 thank you for your review. I have updated the PR so that both notations are supported on Hyper-V ( @jeffmaury thank for looking at this too. This PR addresses an Hyper-V / WSL inconsistency. Supporting |
pkg/config/default_windows.go
Outdated
| // behavior where the host %SystemDrive% (e.g. C:\) is automatically mounted | ||
| // in the guest under /mnt/ (e.g. /mnt/c/) |
There was a problem hiding this comment.
The comment doesn't quite match the code, we mount the drive where the users homedir is located.
I don't know if there is a way for a homedir to be on a different disk compared to C: (%SystemDrive%) in practise (at least super unlikely) so not really that important I guess but maybe we should actually lookup the SystemDrive env?
There was a problem hiding this comment.
Technically the drive of %USERPROFILE% can be different from %SYSTEMDRIVE%. But I still think we should mount %USERPROFILE% drive rather than %SYSTEMDRIVE% as user files are typically there. I have updated the comment.
pkg/config/default_windows_test.go
Outdated
| ) | ||
|
|
||
| func TestGetDefaultMachineVolumes(t *testing.T) { | ||
| t.Parallel() |
There was a problem hiding this comment.
this is incompatible with setenv so you need to remove this.
pkg/config/default_windows_test.go
Outdated
| }, | ||
| } { | ||
| for _, env := range tc.envs { | ||
| os.Setenv(env[0], env[1]) |
There was a problem hiding this comment.
use t.Setenv() then go should rightfully error out and tell you using setenv with parallel is not supported.
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
0282f33 to
2a99bbd
Compare
|
@Luap99 thank you for the review. I have updated the PR taking into account your feedback. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: l0rd, Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@baude @containers/podman-maintainers PTAL |
|
@baude @n1hility @ashley-cui PTAL |
|
/lgtm |
Currently on Windows, volumes are mounted differently based on the provider:
C:/under/mnt/con every Linux VMpodmanmountsC:\Users\nameunder/Users/nameIssues like this one are the consequence of such behavior.
With this PR
getDefaultMachineVolumes()is updated to be consistent with WSL default behavior. That means that on both WSL and HyperV machines, the default volumes will be the%userprofile%drive (e.g.C:/) mounted under/mnt/(e.g./mnt/c).The old Hyper-V mount is still supported. Users can still use the notation
podman run -v /Userswhen the provider is Hyper-V although the notationpodman run -v C:\Usersshould be preferred.