Merge pull request #18717 from anusha-ragunathan/rm-mount-bld-iface

Remove Mount/Unmount from Builder interface.
This commit is contained in:
David Calavera 2015-12-16 13:34:06 -08:00
commit e21d06a972
4 changed files with 6 additions and 36 deletions

View file

@ -141,12 +141,6 @@ type Backend interface {
//ContainerCopy(name string, res string) (io.ReadCloser, error)
// TODO: use copyBackend api
BuilderCopy(containerID string, destPath string, src FileInfo, decompress bool) error
// TODO: remove
// Mount mounts the root filesystem for the container.
Mount(containerID string) error
// Unmount unmounts the root filesystem for the container.
Unmount(containerID string) error
}
// ImageCache abstracts an image cache store.

View file

@ -399,9 +399,6 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
return err
}
b.docker.Mount(cID)
defer b.docker.Unmount(cID)
if err := b.run(cID); err != nil {
return err
}

View file

@ -66,10 +66,6 @@ func (b *Builder) commit(id string, autoCmd *stringutils.StrSlice, comment strin
if err != nil {
return err
}
if err := b.docker.Mount(id); err != nil {
return err
}
defer b.docker.Unmount(id)
}
// Note: Actually copy the struct
@ -193,10 +189,6 @@ func (b *Builder) runContextCommand(args []string, allowRemote bool, allowLocalD
if err != nil {
return err
}
if err := b.docker.Mount(container.ID); err != nil {
return err
}
defer b.docker.Unmount(container.ID)
b.tmpContainers[container.ID] = struct{}{}
comment := fmt.Sprintf("%s %s in %s", cmdName, origPaths, dest)

View file

@ -112,6 +112,12 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d
if err != nil {
return err
}
err = d.Daemon.Mount(c)
if err != nil {
return err
}
defer d.Daemon.Unmount(c)
dest, err := c.GetResourcePath(destPath)
if err != nil {
return err
@ -176,25 +182,6 @@ func (d Docker) BuilderCopy(cID string, destPath string, src builder.FileInfo, d
return fixPermissions(srcPath, destPath, rootUID, rootGID, destExists)
}
// Mount mounts the root filesystem for the container.
func (d Docker) Mount(cID string) error {
c, err := d.Daemon.GetContainer(cID)
if err != nil {
return err
}
return d.Daemon.Mount(c)
}
// Unmount unmounts the root filesystem for the container.
func (d Docker) Unmount(cID string) error {
c, err := d.Daemon.GetContainer(cID)
if err != nil {
return err
}
d.Daemon.Unmount(c)
return nil
}
// GetCachedImage returns a reference to a cached image whose parent equals `parent`
// and runconfig equals `cfg`. A cache miss is expected to return an empty ID and a nil error.
func (d Docker) GetCachedImage(imgID string, cfg *runconfig.Config) (string, error) {