mirror of https://github.com/containers/podman.git
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
This commit is contained in:
parent
6b37608260
commit
4553f2914c
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue