summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-06-04 17:31:49 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-10 11:10:11 +0000
commit1e9e530714ac0a8329dc27e38034380d81247e36 (patch)
tree6e5dd06400ca99fab4d947c3e9ec84a3559af972 /libpod/container_internal.go
parentcb430d58e6eb10dbac686717e822a5784f80b189 (diff)
downloadpodman-1e9e530714ac0a8329dc27e38034380d81247e36.tar.gz
podman-1e9e530714ac0a8329dc27e38034380d81247e36.tar.bz2
podman-1e9e530714ac0a8329dc27e38034380d81247e36.zip
Remove container from state before cleaning up.
Attempt to cleanup as much of the container as possible, even if one of the cleanup stages fails. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #895 Approved by: mheon
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 84724e013..f6d8fc32a 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -261,10 +261,6 @@ func (c *Container) setupStorage(ctx context.Context) error {
// Tear down a container's storage prior to removal
func (c *Container) teardownStorage() error {
- if !c.valid {
- return errors.Wrapf(ErrCtrRemoved, "container %s is not valid", c.ID())
- }
-
if c.state.State == ContainerStateRunning || c.state.State == ContainerStatePaused {
return errors.Wrapf(ErrCtrStateInvalid, "cannot remove storage for container %s as it is running or paused", c.ID())
}
@@ -818,7 +814,10 @@ func (c *Container) cleanupStorage() error {
c.state.Mountpoint = ""
c.state.Mounted = false
- return c.save()
+ if c.valid {
+ return c.save()
+ }
+ return nil
}
// Unmount the a container and free its resources