From e49af5b6def4e69ae234549fbcd2dd2987949cab Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 19 Apr 2013 16:33:25 -0700 Subject: [PATCH] Use aufs to handle parents whitouts instead of doing it manually --- image.go | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/image.go b/image.go index 9369fc3f48..3b5b4be6ea 100644 --- a/image.go +++ b/image.go @@ -92,7 +92,7 @@ func MountAUFS(ro []string, rw string, target string) error { rwBranch := fmt.Sprintf("%v=rw", rw) roBranches := "" for _, layer := range ro { - roBranches += fmt.Sprintf("%v=ro:", layer) + roBranches += fmt.Sprintf("%v=ro+wh:", layer) } branches := fmt.Sprintf("br:%v:%v", rwBranch, roBranches) @@ -127,34 +127,9 @@ func (image *Image) Mount(root, rw string) error { if err := os.Mkdir(rw, 0755); err != nil && !os.IsExist(err) { return err } - // FIXME: @creack shouldn't we do this after going over changes? if err := MountAUFS(layers, rw, root); err != nil { return err } - // FIXME: Create tests for deletion - // FIXME: move this part to change.go - // Retrieve the changeset from the parent and apply it to the container - // - Retrieve the changes - changes, err := Changes(layers, layers[0]) - if err != nil { - return err - } - // Iterate on changes - for _, c := range changes { - // If there is a delete - if c.Kind == ChangeDelete { - // Make sure the directory exists - file_path, file_name := path.Dir(c.Path), path.Base(c.Path) - if err := os.MkdirAll(path.Join(rw, file_path), 0755); err != nil { - return err - } - // And create the whiteout (we just need to create empty file, discard the return) - if _, err := os.Create(path.Join(path.Join(rw, file_path), - ".wh."+path.Base(file_name))); err != nil { - return err - } - } - } return nil }