summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-09-18 09:30:21 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-09-21 11:08:23 -0400
commit0f9a2735b74dac1ae506da1d0ed389bd215a89db (patch)
tree0ffa54f9d45b3f4f64547fe8bfc47af482fd8434 /pkg/domain/infra
parent051912c8e6998047d31cb7b8330ffcf65a4ead40 (diff)
downloadpodman-0f9a2735b74dac1ae506da1d0ed389bd215a89db.tar.gz
podman-0f9a2735b74dac1ae506da1d0ed389bd215a89db.tar.bz2
podman-0f9a2735b74dac1ae506da1d0ed389bd215a89db.zip
Fix podman image unmount to only report images unmounted
Currently `podman image unmount` report every image that is mounted when it unmounts them. We should only report unmounted actually mounted images. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/images.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index cc62c3f27..25c0c184f 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -191,6 +191,15 @@ func (ir *ImageEngine) Unmount(ctx context.Context, nameOrIDs []string, options
reports := []*entities.ImageUnmountReport{}
for _, img := range images {
report := entities.ImageUnmountReport{Id: img.ID()}
+ mounted, _, err := img.Mounted()
+ if err != nil {
+ // Errors will be caught in Unmount call below
+ // Default assumption to mounted
+ mounted = true
+ }
+ if !mounted {
+ continue
+ }
if err := img.Unmount(options.Force); err != nil {
if options.All && errors.Cause(err) == storage.ErrLayerNotMounted {
logrus.Debugf("Error umounting image %s, storage.ErrLayerNotMounted", img.ID())