summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-05-14 10:17:24 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-14 19:44:33 +0000
commit69a6cb255ca98bc7a9e6d47c7a0ccaacab895a25 (patch)
treefa12b706b2622483b11b11d60ed5ec4bf8d0dcc3
parent99532e6f3e5eadf23053736643bd7b39dd4dc69f (diff)
downloadpodman-69a6cb255ca98bc7a9e6d47c7a0ccaacab895a25.tar.gz
podman-69a6cb255ca98bc7a9e6d47c7a0ccaacab895a25.tar.bz2
podman-69a6cb255ca98bc7a9e6d47c7a0ccaacab895a25.zip
Gracefully handle containers removed from c/storage
Allow containers that no longer exist in storage to be evicted from the state instead of erroring. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #764 Approved by: rhatdan
-rw-r--r--libpod/container_internal.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 1c0bcb07f..b0f39fec8 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -277,7 +277,7 @@ func (c *Container) teardownStorage() error {
// error - we wanted it gone, it is already gone.
// Potentially another tool using containers/storage already
// removed it?
- if err == storage.ErrNotAContainer {
+ if err == storage.ErrNotAContainer || err == storage.ErrContainerUnknown {
logrus.Warnf("Storage for container %s already removed", c.ID())
return nil
}
@@ -791,6 +791,15 @@ func (c *Container) cleanupStorage() error {
// Also unmount storage
if err := c.runtime.storageService.UnmountContainerImage(c.ID()); err != nil {
+ // If the container has already been removed, warn but don't
+ // error
+ // We still want to be able to kick the container out of the
+ // state
+ if err == storage.ErrNotAContainer || err == storage.ErrContainerUnknown {
+ logrus.Errorf("Storage for container %s has been removed", c.ID())
+ return nil
+ }
+
return errors.Wrapf(err, "error unmounting container %s root filesystem", c.ID())
}