Merge pull request #26577 from Microsoft/jjh/fstabmount
Windows: Move to fstab options as per OCI
This commit is contained in:
commit
b72c7f74a6
3 changed files with 17 additions and 8 deletions
|
@ -46,11 +46,14 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, mount := range mounts {
|
for _, mount := range mounts {
|
||||||
s.Mounts = append(s.Mounts, windowsoci.Mount{
|
m := windowsoci.Mount{
|
||||||
Source: mount.Source,
|
Source: mount.Source,
|
||||||
Destination: mount.Destination,
|
Destination: mount.Destination,
|
||||||
Readonly: !mount.Writable,
|
}
|
||||||
})
|
if !mount.Writable {
|
||||||
|
m.Options = append(m.Options, "ro")
|
||||||
|
}
|
||||||
|
s.Mounts = append(s.Mounts, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// In s.Process
|
// In s.Process
|
||||||
|
|
|
@ -129,7 +129,13 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
|
||||||
mds[i] = hcsshim.MappedDir{
|
mds[i] = hcsshim.MappedDir{
|
||||||
HostPath: mount.Source,
|
HostPath: mount.Source,
|
||||||
ContainerPath: mount.Destination,
|
ContainerPath: mount.Destination,
|
||||||
ReadOnly: mount.Readonly}
|
ReadOnly: false,
|
||||||
|
}
|
||||||
|
for _, o := range mount.Options {
|
||||||
|
if strings.ToLower(o) == "ro" {
|
||||||
|
mds[i].ReadOnly = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configuration.MappedDirectories = mds
|
configuration.MappedDirectories = mds
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,11 @@ type Mount struct {
|
||||||
Destination string `json:"destination"`
|
Destination string `json:"destination"`
|
||||||
// Type specifies the mount kind.
|
// Type specifies the mount kind.
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
// Source specifies the source path of the mount. In the case of bind mounts
|
// Source specifies the source path of the mount. In the case of bind mounts on
|
||||||
// this would be the file on the host.
|
// Linux based systems this would be the file on the host.
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
// Readonly specifies if the mount should be read-only
|
// Options are fstab style mount options.
|
||||||
Readonly bool `json:"readonly"`
|
Options []string `json:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HvRuntime contains settings specific to Hyper-V containers
|
// HvRuntime contains settings specific to Hyper-V containers
|
||||||
|
|
Loading…
Reference in a new issue