diff options
Diffstat (limited to 'libpod/runtime_volume.go')
-rw-r--r-- | libpod/runtime_volume.go | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libpod/runtime_volume.go b/libpod/runtime_volume.go index efc3c5bd9..d5fede1d1 100644 --- a/libpod/runtime_volume.go +++ b/libpod/runtime_volume.go @@ -35,7 +35,6 @@ func (r *Runtime) RemoveVolume(ctx context.Context, v *Volume, force bool) error return nil } } - return r.removeVolume(ctx, v, force) } @@ -130,26 +129,22 @@ func (r *Runtime) GetAllVolumes() ([]*Volume, error) { } // PruneVolumes removes unused volumes from the system -func (r *Runtime) PruneVolumes(ctx context.Context) ([]string, []error) { - var ( - prunedIDs []string - pruneErrors []error - ) +func (r *Runtime) PruneVolumes(ctx context.Context) (map[string]error, error) { + reports := make(map[string]error) vols, err := r.GetAllVolumes() if err != nil { - pruneErrors = append(pruneErrors, err) - return nil, pruneErrors + return nil, err } for _, vol := range vols { if err := r.RemoveVolume(ctx, vol, false); err != nil { if errors.Cause(err) != define.ErrVolumeBeingUsed && errors.Cause(err) != define.ErrVolumeRemoved { - pruneErrors = append(pruneErrors, err) + reports[vol.Name()] = err } continue } vol.newVolumeEvent(events.Prune) - prunedIDs = append(prunedIDs, vol.Name()) + reports[vol.Name()] = nil } - return prunedIDs, pruneErrors + return reports, nil } |