Browse code

Windows: Move to fstab options as per OCI

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/15 03:35:31
Showing 3 changed files
... ...
@@ -46,11 +46,14 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
46 46
 		return nil, err
47 47
 	}
48 48
 	for _, mount := range mounts {
49
-		s.Mounts = append(s.Mounts, windowsoci.Mount{
49
+		m := windowsoci.Mount{
50 50
 			Source:      mount.Source,
51 51
 			Destination: mount.Destination,
52
-			Readonly:    !mount.Writable,
53
-		})
52
+		}
53
+		if !mount.Writable {
54
+			m.Options = append(m.Options, "ro")
55
+		}
56
+		s.Mounts = append(s.Mounts, m)
54 57
 	}
55 58
 
56 59
 	// In s.Process
... ...
@@ -126,7 +126,13 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
126 126
 		mds[i] = hcsshim.MappedDir{
127 127
 			HostPath:      mount.Source,
128 128
 			ContainerPath: mount.Destination,
129
-			ReadOnly:      mount.Readonly}
129
+			ReadOnly:      false,
130
+		}
131
+		for _, o := range mount.Options {
132
+			if strings.ToLower(o) == "ro" {
133
+				mds[i].ReadOnly = true
134
+			}
135
+		}
130 136
 	}
131 137
 	configuration.MappedDirectories = mds
132 138
 
... ...
@@ -96,11 +96,11 @@ type Mount struct {
96 96
 	Destination string `json:"destination"`
97 97
 	// Type specifies the mount kind.
98 98
 	Type string `json:"type"`
99
-	// Source specifies the source path of the mount.  In the case of bind mounts
100
-	// this would be the file on the host.
99
+	// Source specifies the source path of the mount.  In the case of bind mounts on
100
+	// Linux based systems this would be the file on the host.
101 101
 	Source string `json:"source"`
102
-	// Readonly specifies if the mount should be read-only
103
-	Readonly bool `json:"readonly"`
102
+	// Options are fstab style mount options.
103
+	Options []string `json:"options,omitempty"`
104 104
 }
105 105
 
106 106
 // HvRuntime contains settings specific to Hyper-V containers