diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-10-30 10:12:40 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2018-10-30 10:12:40 -0500 |
commit | dcb68d1aa24b2dd00d793f5a66f96cc5403b43c3 (patch) | |
tree | 230cc7586cf8d333680f27b915a65cf587e72a6b /libpod/container_api.go | |
parent | eb4c2035aef32fd7f0037bbea0447205fcd29d33 (diff) | |
parent | ce24ce7c530f8fb0354d3af7b394240a3915b733 (diff) | |
download | podman-dcb68d1aa24b2dd00d793f5a66f96cc5403b43c3.tar.gz podman-dcb68d1aa24b2dd00d793f5a66f96cc5403b43c3.tar.bz2 podman-dcb68d1aa24b2dd00d793f5a66f96cc5403b43c3.zip |
Merge branch 'master' of github.com:containers/libpod into vendor
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 41a131ea2..e522038a3 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -453,22 +453,19 @@ func (c *Container) Unmount(force bool) error { } } - if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused { - return errors.Wrapf(ErrCtrStateInvalid, "cannot unmount storage for container %s as it is running or paused", c.ID()) - } - - // Check if we have active exec sessions - if len(c.state.ExecSessions) != 0 { - return errors.Wrapf(ErrCtrStateInvalid, "container %s has active exec sessions, refusing to unmount", c.ID()) - } - if c.state.Mounted { mounted, err := c.runtime.storageService.MountedContainerImage(c.ID()) if err != nil { return errors.Wrapf(err, "can't determine how many times %s is mounted, refusing to unmount", c.ID()) } if mounted == 1 { - return errors.Wrapf(err, "can't unmount %s last mount, it is still in use", c.ID()) + if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused { + return errors.Wrapf(ErrCtrStateInvalid, "cannot unmount storage for container %s as it is running or paused", c.ID()) + } + if len(c.state.ExecSessions) != 0 { + return errors.Wrapf(ErrCtrStateInvalid, "container %s has active exec sessions, refusing to unmount", c.ID()) + } + return errors.Wrapf(ErrInternal, "can't unmount %s last mount, it is still in use", c.ID()) } } return c.unmount(force) |