diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-05 20:49:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 20:49:17 +0200 |
commit | 864aec8bb011a7a42cf0a2faca39f6e27118b805 (patch) | |
tree | 788d16fa62d44244150cab2105ac5fe937cd3c09 /libpod | |
parent | fb6eca50ba9e2dc652da0c33c72db70ab9da85e9 (diff) | |
parent | 25312bb5b4e2bd4e122703006fc85bbf080e5e7c (diff) | |
download | podman-864aec8bb011a7a42cf0a2faca39f6e27118b805.tar.gz podman-864aec8bb011a7a42cf0a2faca39f6e27118b805.tar.bz2 podman-864aec8bb011a7a42cf0a2faca39f6e27118b805.zip |
Merge pull request #6081 from baude/v2system
v2 system subcommand
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/volume.go | 13 |
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) +} |