summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-14 12:51:39 -0700
committerGitHub <noreply@github.com>2020-05-14 12:51:39 -0700
commit0d9625152b9acf1dc7662e38f56aa5b106c4dfcd (patch)
treed94b1fc1a778144348e85abf1fd4b61da4f54823 /libpod/container_internal.go
parent32268eaa6239057b82445172bf8128dabec0fe14 (diff)
parent892d81685c9fc213b0e9d444f953577ebb89593b (diff)
downloadpodman-0d9625152b9acf1dc7662e38f56aa5b106c4dfcd.tar.gz
podman-0d9625152b9acf1dc7662e38f56aa5b106c4dfcd.tar.bz2
podman-0d9625152b9acf1dc7662e38f56aa5b106c4dfcd.zip
Merge pull request #6229 from mheon/small_kata_fix
Cleanup OCI runtime before storage
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 3fcf687ec..5baa5fc1c 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1562,21 +1562,24 @@ func (c *Container) cleanup(ctx context.Context) error {
lastError = errors.Wrapf(err, "error removing container %s network", c.ID())
}
- // Unmount storage
- if err := c.cleanupStorage(); err != nil {
+ // Remove the container from the runtime, if necessary.
+ // Do this *before* unmounting storage - some runtimes (e.g. Kata)
+ // apparently object to having storage removed while the container still
+ // exists.
+ if err := c.cleanupRuntime(ctx); err != nil {
if lastError != nil {
- logrus.Errorf("Error unmounting container %s storage: %v", c.ID(), err)
+ logrus.Errorf("Error removing container %s from OCI runtime: %v", c.ID(), err)
} else {
- lastError = errors.Wrapf(err, "error unmounting container %s storage", c.ID())
+ lastError = err
}
}
- // Remove the container from the runtime, if necessary
- if err := c.cleanupRuntime(ctx); err != nil {
+ // Unmount storage
+ if err := c.cleanupStorage(); err != nil {
if lastError != nil {
- logrus.Errorf("Error removing container %s from OCI runtime: %v", c.ID(), err)
+ logrus.Errorf("Error unmounting container %s storage: %v", c.ID(), err)
} else {
- lastError = err
+ lastError = errors.Wrapf(err, "error unmounting container %s storage", c.ID())
}
}