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:
parent
167601e858
commit
e368c8bb01
3 changed files with 6 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
2
image.go
2
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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue