summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-04-15 15:44:32 -0400
committerPeter Hunt <pehunt@redhat.com>2019-04-16 11:23:18 -0400
commit4319552cf89e72925a80c63f427e5ef0a6376046 (patch)
tree5a0e38e63a41fdafe7f5d08daf496a0d68341aae /cmd/podman
parent0b34b4a59cf090a47a2a13cc4814954c497b3d49 (diff)
downloadpodman-4319552cf89e72925a80c63f427e5ef0a6376046.tar.gz
podman-4319552cf89e72925a80c63f427e5ef0a6376046.tar.bz2
podman-4319552cf89e72925a80c63f427e5ef0a6376046.zip
Added remote pod prune
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/pods_prune.go12
-rw-r--r--cmd/podman/varlink/io.podman.varlink3
2 files changed, 5 insertions, 10 deletions
diff --git a/cmd/podman/pods_prune.go b/cmd/podman/pods_prune.go
index 4ffe6fc27..89401a98a 100644
--- a/cmd/podman/pods_prune.go
+++ b/cmd/podman/pods_prune.go
@@ -5,7 +5,6 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -43,15 +42,8 @@ func init() {
func prunePods(runtime *adapter.LocalRuntime, ctx context.Context, maxWorkers int, force bool) error {
var deleteFuncs []shared.ParallelWorkerInput
- filter := func(p *libpod.Pod) bool {
- state, err := shared.GetPodStatus(p)
- // pod states should be the same
- if state == shared.PodStateStopped || (state == shared.PodStateExited && err == nil) {
- return true
- }
- return false
- }
- delPods, err := runtime.Pods(filter)
+ states := []string{shared.PodStateStopped, shared.PodStateExited}
+ delPods, err := runtime.GetPodsByStatus(states)
if err != nil {
return err
}
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index b5295273a..497f130bc 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -1053,6 +1053,9 @@ method TopPod(pod: string, latest: bool, descriptors: []string) -> (stats: []str
# ~~~
method GetPodStats(name: string) -> (pod: string, containers: []ContainerStats)
+# GetPodsByStatus searches for pods whose status is included in statuses
+method GetPodsByStatus(statuses: []string) -> (pods: []string)
+
# ImageExists talks a full or partial image ID or name and returns an int as to whether
# the image exists in local storage. An int result of 0 means the image does exist in
# local storage; whereas 1 indicates the image does not exists in local storage.