summaryrefslogtreecommitdiff
path: root/libpod/runtime_volume.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-21 23:11:24 +0100
committerGitHub <noreply@github.com>2019-02-21 23:11:24 +0100
commiteb6243226a08254f15657c3728bb4dd8949ee6cd (patch)
tree25fea4777a578895b9ac0f5f6c2e19860fc2e4bd /libpod/runtime_volume.go
parentb4c10790d514538277a937a443219e4310cb057f (diff)
parent19eb72f4206192b22856eef24ce3815eac3d7bda (diff)
downloadpodman-eb6243226a08254f15657c3728bb4dd8949ee6cd.tar.gz
podman-eb6243226a08254f15657c3728bb4dd8949ee6cd.tar.bz2
podman-eb6243226a08254f15657c3728bb4dd8949ee6cd.zip
Merge pull request #2350 from mheon/lock_renumber
Add lock renumbering
Diffstat (limited to 'libpod/runtime_volume.go')
-rw-r--r--libpod/runtime_volume.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/libpod/runtime_volume.go b/libpod/runtime_volume.go
index beae50ac9..11f37ad4b 100644
--- a/libpod/runtime_volume.go
+++ b/libpod/runtime_volume.go
@@ -19,7 +19,7 @@ type VolumeCreateOption func(*Volume) error
type VolumeFilter func(*Volume) bool
// RemoveVolume removes a volumes
-func (r *Runtime) RemoveVolume(ctx context.Context, v *Volume, force, prune bool) error {
+func (r *Runtime) RemoveVolume(ctx context.Context, v *Volume, force bool) error {
r.lock.Lock()
defer r.lock.Unlock()
@@ -35,10 +35,7 @@ func (r *Runtime) RemoveVolume(ctx context.Context, v *Volume, force, prune bool
}
}
- v.lock.Lock()
- defer v.lock.Unlock()
-
- return r.removeVolume(ctx, v, force, prune)
+ return r.removeVolume(ctx, v, force)
}
// RemoveVolumes removes a slice of volumes or all with a force bool
@@ -64,7 +61,7 @@ func (r *Runtime) RemoveVolumes(ctx context.Context, volumes []string, all, forc
}
for _, vol := range vols {
- if err := r.RemoveVolume(ctx, vol, force, false); err != nil {
+ if err := r.RemoveVolume(ctx, vol, force); err != nil {
return deletedVols, err
}
logrus.Debugf("removed volume %s", vol.Name())
@@ -168,8 +165,8 @@ func (r *Runtime) PruneVolumes(ctx context.Context) ([]string, []error) {
}
for _, vol := range vols {
- if err := r.RemoveVolume(ctx, vol, false, true); err != nil {
- if err != ErrVolumeBeingUsed {
+ if err := r.RemoveVolume(ctx, vol, false); err != nil {
+ if errors.Cause(err) != ErrVolumeBeingUsed && errors.Cause(err) != ErrVolumeRemoved {
pruneErrors = append(pruneErrors, err)
}
continue