瀏覽代碼

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
Alexander Larsson 12 年之前
父節點
當前提交
8637ba710e
共有 3 個文件被更改,包括 6 次插入3 次删除
  1. 1 1
      container.go
  2. 4 1
      graph_test.go
  3. 1 1
      image.go

+ 1 - 1
container.go

@@ -1157,7 +1157,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) {

+ 4 - 1
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

+ 1 - 1
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 {