aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-31 21:27:28 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-02 14:22:57 +0000
commit4553f2914c94f7095b3ae9b3724bd67a1347b87f (patch)
tree352b644be28fb12511caded8e03ddf1839e831ac /libpod
parent6b37608260795887c6ad34433568918d3dfb159e (diff)
downloadpodman-4553f2914c94f7095b3ae9b3724bd67a1347b87f.tar.gz
podman-4553f2914c94f7095b3ae9b3724bd67a1347b87f.tar.bz2
podman-4553f2914c94f7095b3ae9b3724bd67a1347b87f.zip
More gracefully handle unexpected storage deletion
We have other tools using containers/storage. They can delete our containers in c/storage without us knowing. Try and handle this better by warning instead of erroring when delete our storage and it is already gone. This does not handle cases where libpod thinks the container is mounted, but it is not. This is harder to check for, because c/storage Mount() and Unmount() take a layer, image, or container and that complicates our "container no longer exists" question. Further work is needed here. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #571 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 4bfdfae9d..efeb1fa77 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -223,6 +223,15 @@ func (c *Container) teardownStorage() error {
}
if err := c.runtime.storageService.DeleteContainer(c.ID()); err != nil {
+ // If the container has already been removed, warn but do not
+ // error - we wanted it gone, it is already gone.
+ // Potentially another tool using containers/storage already
+ // removed it?
+ if err == storage.ErrNotAContainer {
+ logrus.Errorf("Storage for container %s already removed", c.ID())
+ return nil
+ }
+
return errors.Wrapf(err, "error removing container %s root filesystem", c.ID())
}