2015-04-27 12:25:38 -04:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package daemon
|
|
|
|
|
2015-06-03 12:26:41 -04:00
|
|
|
import (
|
|
|
|
"github.com/docker/docker/daemon/execdriver"
|
2015-09-09 22:23:06 -04:00
|
|
|
derr "github.com/docker/docker/errors"
|
|
|
|
"github.com/docker/docker/volume"
|
|
|
|
"sort"
|
2015-06-03 12:26:41 -04:00
|
|
|
)
|
2015-05-19 16:05:25 -04:00
|
|
|
|
2015-09-09 22:23:06 -04:00
|
|
|
// setupMounts configures the mount points for a container by appending each
|
|
|
|
// of the configured mounts on the container to the execdriver mount structure
|
|
|
|
// which will ultimately be passed into the exec driver during container creation.
|
|
|
|
// It also ensures each of the mounts are lexographically sorted.
|
2015-05-19 16:05:25 -04:00
|
|
|
func (container *Container) setupMounts() ([]execdriver.Mount, error) {
|
2015-09-09 22:23:06 -04:00
|
|
|
var mnts []execdriver.Mount
|
|
|
|
for _, mount := range container.MountPoints { // type is volume.MountPoint
|
|
|
|
// If there is no source, take it from the volume path
|
|
|
|
s := mount.Source
|
|
|
|
if s == "" && mount.Volume != nil {
|
|
|
|
s = mount.Volume.Path()
|
|
|
|
}
|
|
|
|
if s == "" {
|
|
|
|
return nil, derr.ErrorCodeVolumeNoSourceForMount.WithArgs(mount.Name, mount.Driver, mount.Destination)
|
|
|
|
}
|
|
|
|
mnts = append(mnts, execdriver.Mount{
|
|
|
|
Source: s,
|
|
|
|
Destination: mount.Destination,
|
|
|
|
Writable: mount.RW,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
sort.Sort(mounts(mnts))
|
|
|
|
return mnts, nil
|
2015-04-29 18:53:35 -04:00
|
|
|
}
|
2015-06-08 16:45:28 -04:00
|
|
|
|
2015-07-16 17:14:58 -04:00
|
|
|
// verifyVolumesInfo ports volumes configured for the containers pre docker 1.7.
|
|
|
|
// As the Windows daemon was not supported before 1.7, this is a no-op
|
|
|
|
func (daemon *Daemon) verifyVolumesInfo(container *Container) error {
|
2015-06-08 16:45:28 -04:00
|
|
|
return nil
|
|
|
|
}
|
2015-06-03 12:26:41 -04:00
|
|
|
|
2015-09-09 22:23:06 -04:00
|
|
|
// setBindModeIfNull is platform specific processing which is a no-op on
|
|
|
|
// Windows.
|
|
|
|
func setBindModeIfNull(bind *volume.MountPoint) *volume.MountPoint {
|
|
|
|
return bind
|
|
|
|
}
|
|
|
|
|
|
|
|
// configureBackCompatStructures is platform specific processing for
|
|
|
|
// registering mount points to populate old structures. This is a no-op on Windows.
|
|
|
|
func configureBackCompatStructures(*Daemon, *Container, map[string]*volume.MountPoint) (map[string]string, map[string]bool) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// setBackCompatStructures is a platform specific helper function to set
|
|
|
|
// backwards compatible structures in the container when registering volumes.
|
|
|
|
// This is a no-op on Windows.
|
|
|
|
func setBackCompatStructures(*Container, map[string]string, map[string]bool) {
|
2015-06-03 12:26:41 -04:00
|
|
|
}
|