-
Notifications
You must be signed in to change notification settings - Fork 574
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
Fixed volume mount issue(759) for Windows #902
Conversation
@click2cloud-lamda could you sign off on commits? https://github.com/containerd/project/blob/main/CONTRIBUTING.md#sign-your-work |
The windows build failure looks like it was maybe a flake in cirrus?
|
"-v", fmt.Sprintf("%s:C:\\mnt3", rwVolName), | ||
"-v", fmt.Sprintf("%s:C:\\mnt4ro", roVolName), | ||
testutil.WindowsNano).AssertOK() | ||
base.Cmd("container", "inspect", containerName).AssertOK() |
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.
This validates the container started ok but should we validate the mounts are in the right place?
base.Cmd("run", | ||
"-d", | ||
"--name", containerName, | ||
"-v", fmt.Sprintf("%s:C:\\mnt1", rwDir), |
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.
Is there a test for the left side having c:\
?
pkg/mountutil/mountutil.go
Outdated
// assume src is a volume name | ||
vol, err := volStore.Get(src) | ||
|
||
if runtime.GOOS == "windows" { |
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.
This seems like a good place to have separate files (_windows.go
and _linux.go
) for each implementation of the large nested if statement.
pkg/mountutil/mountutil.go
Outdated
fstype := "nullfs" | ||
if runtime.GOOS != "freebsd" { | ||
fstype = "none" | ||
fstype = "" |
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.
why is this being dropped?
pkg/mountutil/mountutil_windows.go
Outdated
@@ -38,31 +41,195 @@ const DefaultPropagationMode = "" | |||
|
|||
// parseVolumeOptions parses specified optsRaw with using information of | |||
// the volume type and the src directory when necessary. | |||
//func parseVolumeOptions(vType, src, optsRaw string) ([]string, []oci.SpecOpts, 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.
remove unused code.
pkg/mountutil/mountutil_windows.go
Outdated
// - OCI Runtime Spec: https://github.com/opencontainers/runtime-spec/blob/v1.0.2/config-linux.md#rootfs-mount-propagation | ||
// - runc implementation: https://github.com/opencontainers/runc/blob/v1.0.0/libcontainer/rootfs_linux.go#L771-L777 | ||
specOpts = append(specOpts, func(ctx context.Context, cli oci.Client, c *containers.Container, s *oci.Spec) error { | ||
switch s.Linux.RootfsPropagation { |
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.
Why is there linux specific implementaitons details in the _windows.go
file?
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.
Is this copied from somewhere else? please leave attribution if so
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 for looking at this. Left a few comments.
Please add DCO sign |
Signed-off-by: click2cloud-lamda <click2cloud-lamda@click2cloud.net>
a00cab7
to
340624d
Compare
# Conflicts: # pkg/mountutil/mountutil.go # pkg/mountutil/mountutil_windows.go
Please use real name |
Signed-off-by: Raymond Mathew <click2cloud-lamda@click2cloud.net> Signed-off-by: click2cloud-lamda <click2cloud-lamda@click2cloud.net>
Fixed issue #759 :
When using nerdctl + containerd on Windows, I am able to mount volumes or bind mount to a new windows container and are also able to use bind propagation.
Signed-off-by: Raymond Mathew click2cloud-lamda@click2cloud.net