Windows: Move to fstab options as per OCI

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-09-14 11:35:31 -07:00
parent 9e9ba1e1c1
commit bb585b9c10
3 changed files with 17 additions and 8 deletions

View File

@ -46,11 +46,14 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
return nil, err
}
for _, mount := range mounts {
s.Mounts = append(s.Mounts, windowsoci.Mount{
m := windowsoci.Mount{
Source: mount.Source,
Destination: mount.Destination,
Readonly: !mount.Writable,
})
}
if !mount.Writable {
m.Options = append(m.Options, "ro")
}
s.Mounts = append(s.Mounts, m)
}
// In s.Process

View File

@ -126,7 +126,13 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
mds[i] = hcsshim.MappedDir{
HostPath: mount.Source,
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

View File

@ -96,11 +96,11 @@ type Mount struct {
Destination string `json:"destination"`
// Type specifies the mount kind.
Type string `json:"type"`
// Source specifies the source path of the mount. In the case of bind mounts
// this would be the file on the host.
// Source specifies the source path of the mount. In the case of bind mounts on
// Linux based systems this would be the file on the host.
Source string `json:"source"`
// Readonly specifies if the mount should be read-only
Readonly bool `json:"readonly"`
// Options are fstab style mount options.
Options []string `json:"options,omitempty"`
}
// HvRuntime contains settings specific to Hyper-V containers