summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-03-21 14:29:30 -0500
committerBrent Baude <bbaude@redhat.com>2020-03-24 16:03:49 -0500
commitae614920bfe2510ca6d1dd6cea02bbe17ddb245c (patch)
tree5edd6e5fd01f12154c82146ce6170aaf7d716e19 /libpod
parent0c084d9719772a9b68d5eb67114cf5bf001958b2 (diff)
downloadpodman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.tar.gz
podman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.tar.bz2
podman-ae614920bfe2510ca6d1dd6cea02bbe17ddb245c.zip
podmanv2 volumes
add volume commands: create, inspect, ls, prune, and rm Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime_volume.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/libpod/runtime_volume.go b/libpod/runtime_volume.go
index efc3c5bd9..d522ffb6c 100644
--- a/libpod/runtime_volume.go
+++ b/libpod/runtime_volume.go
@@ -5,6 +5,7 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
+ "github.com/containers/libpod/pkg/domain/entities"
"github.com/pkg/errors"
)
@@ -35,7 +36,6 @@ func (r *Runtime) RemoveVolume(ctx context.Context, v *Volume, force bool) error
return nil
}
}
-
return r.removeVolume(ctx, v, force)
}
@@ -130,26 +130,24 @@ func (r *Runtime) GetAllVolumes() ([]*Volume, error) {
}
// PruneVolumes removes unused volumes from the system
-func (r *Runtime) PruneVolumes(ctx context.Context) ([]string, []error) {
+func (r *Runtime) PruneVolumes(ctx context.Context) ([]*entities.VolumePruneReport, error) {
var (
- prunedIDs []string
- pruneErrors []error
+ reports []*entities.VolumePruneReport
)
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 = append(reports, &entities.VolumePruneReport{Id: vol.Name(), Err: err})
}
continue
}
vol.newVolumeEvent(events.Prune)
- prunedIDs = append(prunedIDs, vol.Name())
+ reports = append(reports, &entities.VolumePruneReport{Id: vol.Name()})
}
- return prunedIDs, pruneErrors
+ return reports, nil
}