1
0
mirror of https://github.com/moby/moby.git synced 2025-08-01 05:47:11 +03:00

Merge pull request #36637 from cpuguy83/no_global_driver_store

No global volume driver store
This commit is contained in:
Brian Goff
2018-04-18 16:32:23 -04:00
committed by GitHub
19 changed files with 236 additions and 582 deletions

View File

@ -35,7 +35,6 @@ import (
testdaemon "github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/stringid"
units "github.com/docker/go-units"
"github.com/docker/libnetwork/iptables"
"github.com/docker/libtrust"
@ -2668,84 +2667,6 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
c.Assert(out, checker.Equals, errMsg1)
}
func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
testRequires(c, SameHostDaemon)
d := s.d
d.StartWithBusybox(c)
// hack to be able to side-load a container config
out, err := d.Cmd("create", "busybox:latest")
c.Assert(err, checker.IsNil, check.Commentf(out))
id := strings.TrimSpace(out)
out, err = d.Cmd("inspect", "--type=image", "--format={{.ID}}", "busybox:latest")
c.Assert(err, checker.IsNil, check.Commentf(out))
d.Stop(c)
<-d.Wait
imageID := strings.TrimSpace(out)
volumeID := stringid.GenerateNonCryptoID()
vfsPath := filepath.Join(d.Root, "vfs", "dir", volumeID)
c.Assert(os.MkdirAll(vfsPath, 0755), checker.IsNil)
config := []byte(`
{
"ID": "` + id + `",
"Name": "hello",
"Driver": "` + d.StorageDriver() + `",
"Image": "` + imageID + `",
"Config": {"Image": "busybox:latest"},
"NetworkSettings": {},
"Volumes": {
"/bar":"/foo",
"/foo": "` + vfsPath + `",
"/quux":"/quux"
},
"VolumesRW": {
"/bar": true,
"/foo": true,
"/quux": false
}
}
`)
configPath := filepath.Join(d.Root, "containers", id, "config.v2.json")
c.Assert(ioutil.WriteFile(configPath, config, 600), checker.IsNil)
d.Start(c)
out, err = d.Cmd("inspect", "--type=container", "--format={{ json .Mounts }}", id)
c.Assert(err, checker.IsNil, check.Commentf(out))
type mount struct {
Name string
Source string
Destination string
Driver string
RW bool
}
ls := []mount{}
err = json.NewDecoder(strings.NewReader(out)).Decode(&ls)
c.Assert(err, checker.IsNil)
expected := []mount{
{Source: "/foo", Destination: "/bar", RW: true},
{Name: volumeID, Destination: "/foo", RW: true},
{Source: "/quux", Destination: "/quux", RW: false},
}
c.Assert(ls, checker.HasLen, len(expected))
for _, m := range ls {
var matched bool
for _, x := range expected {
if m.Source == x.Source && m.Destination == x.Destination && m.RW == x.RW || m.Name != x.Name {
matched = true
break
}
}
c.Assert(matched, checker.True, check.Commentf("did find match for %+v", m))
}
}
func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux)