Fix read-write check for volumes.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 82a54001fdbd3d0c9bcdab1b5caf0a6c6c8079be
Component: engine
This commit is contained in:
David Calavera
2015-07-14 15:49:18 -07:00
parent 630edf5b02
commit 9ec8332d92
2 changed files with 6 additions and 1 deletions

View File

@ -172,7 +172,7 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
cp := &mountPoint{
Name: m.Name,
Source: m.Source,
RW: m.RW && !roModes[mode],
RW: m.RW && volume.ReadWrite(mode),
Driver: m.Driver,
Destination: m.Destination,
}

View File

@ -50,3 +50,8 @@ var roModes = map[string]bool{
func ValidateMountMode(mode string) (bool, bool) {
return roModes[mode] || rwModes[mode], rwModes[mode]
}
// ReadOnly tells you if a mode string is a valid read-only mode or not.
func ReadWrite(mode string) bool {
return rwModes[mode]
}