1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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
This commit is contained in:
Alexander Larsson 2013-09-04 11:41:38 +02:00 committed by Tianon Gravi
parent 167601e858
commit e368c8bb01
3 changed files with 6 additions and 3 deletions

View file

@ -1158,7 +1158,7 @@ func (container *Container) Mount() error {
if err != nil { if err != nil {
return err 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) { func (container *Container) Changes() ([]Change, error) {

View file

@ -121,6 +121,9 @@ func TestRegister(t *testing.T) {
} }
func TestMount(t *testing.T) { func TestMount(t *testing.T) {
runtime := mkRuntime(t)
defer nuke(runtime)
graph := tempGraph(t) graph := tempGraph(t)
defer os.RemoveAll(graph.Root) defer os.RemoveAll(graph.Root)
archive, err := fakeTar() archive, err := fakeTar()
@ -144,7 +147,7 @@ func TestMount(t *testing.T) {
if err := os.MkdirAll(rw, 0700); err != nil { if err := os.MkdirAll(rw, 0700); err != nil {
t.Fatal(err) t.Fatal(err)
} }
if err := image.Mount(rootfs, rw); err != nil { if err := image.Mount(runtime, rootfs, rw, "testing"); err != nil {
t.Fatal(err) t.Fatal(err)
} }
// FIXME: test for mount contents // FIXME: test for mount contents

View file

@ -170,7 +170,7 @@ func (image *Image) TarLayer(compression Compression) (Archive, error) {
return Tar(layerPath, compression) 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 { if mounted, err := Mounted(root); err != nil {
return err return err
} else if mounted { } else if mounted {