Remove container.EnsureMounted
This was deprecated already and all it did was call Mount(). The use of this was a bit confusing since we need to pair Mount/Unmount calls which wasn't obvious with "EnsureMounted". Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
parent
bcaf6c2359
commit
191aa17d16
4 changed files with 10 additions and 16 deletions
|
@ -488,7 +488,7 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||||
}
|
}
|
||||||
b.tmpContainers[container.ID] = struct{}{}
|
b.tmpContainers[container.ID] = struct{}{}
|
||||||
|
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer container.Unmount()
|
defer container.Unmount()
|
||||||
|
@ -610,7 +610,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
|
||||||
b.tmpContainers[container.ID] = struct{}{}
|
b.tmpContainers[container.ID] = struct{}{}
|
||||||
fmt.Fprintf(b.outStream, " ---> Running in %s\n", utils.TruncateID(container.ID))
|
fmt.Fprintf(b.outStream, " ---> Running in %s\n", utils.TruncateID(container.ID))
|
||||||
id = container.ID
|
id = container.ID
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer container.Unmount()
|
defer container.Unmount()
|
||||||
|
|
18
container.go
18
container.go
|
@ -200,7 +200,7 @@ func (settings *NetworkSettings) PortMappingAPI() []APIPort {
|
||||||
|
|
||||||
// Inject the io.Reader at the given path. Note: do not close the reader
|
// Inject the io.Reader at the given path. Note: do not close the reader
|
||||||
func (container *Container) Inject(file io.Reader, pth string) error {
|
func (container *Container) Inject(file io.Reader, pth string) error {
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return fmt.Errorf("inject: error mounting container %s: %s", container.ID, err)
|
return fmt.Errorf("inject: error mounting container %s: %s", container.ID, err)
|
||||||
}
|
}
|
||||||
defer container.Unmount()
|
defer container.Unmount()
|
||||||
|
@ -505,7 +505,7 @@ func (container *Container) Start() (err error) {
|
||||||
container.cleanup()
|
container.cleanup()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if container.runtime.networkManager.disabled {
|
if container.runtime.networkManager.disabled {
|
||||||
|
@ -1271,7 +1271,7 @@ func (container *Container) Resize(h, w int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) ExportRw() (archive.Archive, error) {
|
func (container *Container) ExportRw() (archive.Archive, error) {
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if container.runtime == nil {
|
if container.runtime == nil {
|
||||||
|
@ -1283,7 +1283,7 @@ func (container *Container) ExportRw() (archive.Archive, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) Export() (archive.Archive, error) {
|
func (container *Container) Export() (archive.Archive, error) {
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1309,12 +1309,6 @@ func (container *Container) WaitTimeout(timeout time.Duration) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) EnsureMounted() error {
|
|
||||||
// FIXME: EnsureMounted is deprecated because drivers are now responsible
|
|
||||||
// for re-entrant mounting in their Get() method.
|
|
||||||
return container.Mount()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (container *Container) Mount() error {
|
func (container *Container) Mount() error {
|
||||||
return container.runtime.Mount(container)
|
return container.runtime.Mount(container)
|
||||||
}
|
}
|
||||||
|
@ -1412,7 +1406,7 @@ func (container *Container) GetSize() (int64, int64) {
|
||||||
driver = container.runtime.driver
|
driver = container.runtime.driver
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
utils.Errorf("Warning: failed to compute size of container rootfs %s: %s", container.ID, err)
|
utils.Errorf("Warning: failed to compute size of container rootfs %s: %s", container.ID, err)
|
||||||
return sizeRw, sizeRootfs
|
return sizeRw, sizeRootfs
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1438,7 @@ func (container *Container) GetSize() (int64, int64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) Copy(resource string) (archive.Archive, error) {
|
func (container *Container) Copy(resource string) (archive.Archive, error) {
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var filter []string
|
var filter []string
|
||||||
|
|
|
@ -71,7 +71,7 @@ func containerRun(eng *engine.Engine, id string, t utils.Fataler) {
|
||||||
|
|
||||||
func containerFileExists(eng *engine.Engine, id, dir string, t utils.Fataler) bool {
|
func containerFileExists(eng *engine.Engine, id, dir string, t utils.Fataler) bool {
|
||||||
c := getContainer(eng, id, t)
|
c := getContainer(eng, id, t)
|
||||||
if err := c.EnsureMounted(); err != nil {
|
if err := c.Mount(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer c.Unmount()
|
defer c.Unmount()
|
||||||
|
|
|
@ -520,7 +520,7 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
|
||||||
func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, config *Config) (*Image, error) {
|
func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, config *Config) (*Image, error) {
|
||||||
// FIXME: freeze the container before copying it to avoid data corruption?
|
// FIXME: freeze the container before copying it to avoid data corruption?
|
||||||
// FIXME: this shouldn't be in commands.
|
// FIXME: this shouldn't be in commands.
|
||||||
if err := container.EnsureMounted(); err != nil {
|
if err := container.Mount(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer container.Unmount()
|
defer container.Unmount()
|
||||||
|
|
Loading…
Reference in a new issue