summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-05-01 12:57:41 -0500
committerbaude <bbaude@redhat.com>2020-05-05 12:24:33 -0500
commit25312bb5b4e2bd4e122703006fc85bbf080e5e7c (patch)
treef2728cef53f71fcf1c04ff76ab928770fc5c9e50 /libpod
parent4a1331d0afd9a21ff9465916d4006ff7297ae07c (diff)
downloadpodman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.tar.gz
podman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.tar.bz2
podman-25312bb5b4e2bd4e122703006fc85bbf080e5e7c.zip
v2 system subcommand
add system df, info, load, renumber, and migrate Refactor for specialized libpod engines add the ability to prune images, volumes, containers, and pods Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/volume.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/volume.go b/libpod/volume.go
index 70099d6f4..82f389833 100644
--- a/libpod/volume.go
+++ b/libpod/volume.go
@@ -3,6 +3,7 @@ package libpod
import (
"time"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/lock"
)
@@ -133,3 +134,15 @@ func (v *Volume) Config() (*VolumeConfig, error) {
err := JSONDeepCopy(v.config, &config)
return &config, err
}
+
+// VolumeInUse goes through the container dependencies of a volume
+// and checks if the volume is being used by any container.
+func (v *Volume) VolumesInUse() ([]string, error) {
+ v.lock.Lock()
+ defer v.lock.Unlock()
+
+ if !v.valid {
+ return nil, define.ErrVolumeRemoved
+ }
+ return v.runtime.state.VolumeInUse(v)
+}