Преглед на файлове

- Fix a few bugs in external mount-bind integration

Gabriel Monroy преди 12 години
родител
ревизия
67239957c9
променени са 2 файла, в които са добавени 4 реда и са изтрити 6 реда
  1. 1 3
      container.go
  2. 3 3
      lxc_template.go

+ 1 - 3
container.go

@@ -145,11 +145,10 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
 	}
 
 	// add any bind targets to the list of container volumes
-	type empty struct{}
 	for _, bind := range flBinds {
 		arr := strings.Split(bind, ":")
 		dstDir := arr[1]
-		flVolumes[dstDir] = empty{}
+		flVolumes[dstDir] = struct{}{}
 	}
 
 	parsedArgs := cmd.Args()
@@ -564,7 +563,6 @@ func (container *Container) Start(hostConfig *HostConfig) error {
 			container.Volumes[volPath] = id
 		}
 	}
-	container.VolumesRW = make(map[string]bool)
 
 	if err := container.generateLXCConfig(); err != nil {
 		return err

+ 3 - 3
lxc_template.go

@@ -84,9 +84,9 @@ lxc.mount.entry = {{.SysInitPath}} {{$ROOTFS}}/sbin/init none bind,ro 0 0
 # In order to get a working DNS environment, mount bind (ro) the host's /etc/resolv.conf into the container
 lxc.mount.entry = {{.ResolvConfPath}} {{$ROOTFS}}/etc/resolv.conf none bind,ro 0 0
 {{if .Volumes}}
-+{{ $rw := .VolumesRW }}
-+{{range $virtualPath, $realPath := .Volumes}}
-+lxc.mount.entry = {{$realPath}} {{$ROOTFS}}/{{$virtualPath}} none bind,{{ if index $rw $virtualPath }}rw{{else}}ro{{end}} 0 0
+{{ $rw := .VolumesRW }}
+{{range $virtualPath, $realPath := .Volumes}}
+lxc.mount.entry = {{$realPath}} {{$ROOTFS}}/{{$virtualPath}} none bind,{{ if index $rw $virtualPath }}rw{{else}}ro{{end}} 0 0
 {{end}}
 {{end}}