From e368c8bb01b3c52c8e4c334c3a7f32556af9d632 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 4 Sep 2013 11:41:38 +0200 Subject: [PATCH] Image: Add runtime and container id args to Mount() We will later need the runtime to get access to the VolumeSet singleton, and the container id to have a name for the volume for the container --- container.go | 2 +- graph_test.go | 5 ++++- image.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/container.go b/container.go index 316e0d259f..b74e9f2f0e 100644 --- a/container.go +++ b/container.go @@ -1158,7 +1158,7 @@ func (container *Container) Mount() error { if err != nil { return err } - return image.Mount(container.RootfsPath(), container.rwPath()) + return image.Mount(container.runtime, container.RootfsPath(), container.rwPath(), container.ID) } func (container *Container) Changes() ([]Change, error) { diff --git a/graph_test.go b/graph_test.go index 471016938d..d89e6efe9d 100644 --- a/graph_test.go +++ b/graph_test.go @@ -121,6 +121,9 @@ func TestRegister(t *testing.T) { } func TestMount(t *testing.T) { + runtime := mkRuntime(t) + defer nuke(runtime) + graph := tempGraph(t) defer os.RemoveAll(graph.Root) archive, err := fakeTar() @@ -144,7 +147,7 @@ func TestMount(t *testing.T) { if err := os.MkdirAll(rw, 0700); err != nil { t.Fatal(err) } - if err := image.Mount(rootfs, rw); err != nil { + if err := image.Mount(runtime, rootfs, rw, "testing"); err != nil { t.Fatal(err) } // FIXME: test for mount contents diff --git a/image.go b/image.go index 9f34160b80..bbf559e23a 100644 --- a/image.go +++ b/image.go @@ -170,7 +170,7 @@ func (image *Image) TarLayer(compression Compression) (Archive, error) { return Tar(layerPath, compression) } -func (image *Image) Mount(root, rw string) error { +func (image *Image) Mount(runtime *Runtime, root, rw string, id string) error { if mounted, err := Mounted(root); err != nil { return err } else if mounted {