浏览代码

Merge pull request #14639 from calavera/fix_read_write_check

Fix read-write check for volumes.
Jessie Frazelle 10 年之前
父节点
当前提交
8c7cd78650
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 1
      daemon/volumes.go
  2. 5 0
      volume/volume.go

+ 1 - 1
daemon/volumes.go

@@ -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,
 			}

+ 5 - 0
volume/volume.go

@@ -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]
+}