1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Fix volume ref restore process

Fixes #9629 #9768

A couple of issues:

1) Volume config is not restored if we couldn't find it with the graph
driver, but bind-mounts would never be found by the graph driver since
they aren't in that dir

2) container volumes were only being restored if they were found in the
volumes repo, but volumes created by old daemons wouldn't be in the
repo until the container is at least started.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2015-01-16 14:48:25 -05:00
parent 9305020d9f
commit e744b0dcba
4 changed files with 54 additions and 13 deletions

View File

@ -317,3 +317,36 @@ func TestDaemonAllocatesListeningPort(t *testing.T) {
logDone("daemon - daemon listening port is allocated")
}
// #9629
func TestDaemonVolumesBindsRefs(t *testing.T) {
d := NewDaemon(t)
if err := d.StartWithBusybox(); err != nil {
t.Fatal(err)
}
tmp, err := ioutil.TempDir(os.TempDir(), "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmp)
if err := ioutil.WriteFile(tmp+"/test", []byte("testing"), 0655); err != nil {
t.Fatal(err)
}
if out, err := d.Cmd("create", "-v", tmp+":/foo", "--name=voltest", "busybox"); err != nil {
t.Fatal(err, out)
}
if err := d.Restart(); err != nil {
t.Fatal(err)
}
if out, err := d.Cmd("run", "--volumes-from=voltest", "--name=consumer", "busybox", "/bin/sh", "-c", "[ -f /foo/test ]"); err != nil {
t.Fatal(err, out)
}
logDone("daemon - bind refs in data-containers survive daemon restart")
}