summaryrefslogtreecommitdiff
path: root/cmd/podman/pod_stop.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-12-06 15:20:04 -0600
committerbaude <bbaude@redhat.com>2018-12-07 10:27:41 -0600
commit52098941000794180a358a6983237cc6c4d30fc1 (patch)
tree43c3b281705451de684007dbb8e087b2a15a30bf /cmd/podman/pod_stop.go
parenta387c723a90a787a1d35c4a9b3b54347d5c08436 (diff)
downloadpodman-52098941000794180a358a6983237cc6c4d30fc1.tar.gz
podman-52098941000794180a358a6983237cc6c4d30fc1.tar.bz2
podman-52098941000794180a358a6983237cc6c4d30fc1.zip
add timeout to pod stop
like podman stop of containers, we should allow the user to specify a timeout override when stopping pods; otherwise they have to wait the full timeout time specified during the pod/container creation. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/pod_stop.go')
-rw-r--r--cmd/podman/pod_stop.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd/podman/pod_stop.go b/cmd/podman/pod_stop.go
index 14114aa11..d49ba8a00 100644
--- a/cmd/podman/pod_stop.go
+++ b/cmd/podman/pod_stop.go
@@ -2,7 +2,6 @@ package main
import (
"fmt"
-
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -16,6 +15,10 @@ var (
Usage: "stop all running pods",
},
LatestPodFlag,
+ cli.UintFlag{
+ Name: "timeout, time, t",
+ Usage: "Seconds to wait for pod stop before killing the container",
+ },
}
podStopDescription = `
podman pod stop
@@ -35,6 +38,7 @@ var (
)
func podStopCmd(c *cli.Context) error {
+ timeout := -1
if err := checkMutuallyExclusiveFlags(c); err != nil {
return err
}
@@ -52,9 +56,12 @@ func podStopCmd(c *cli.Context) error {
ctx := getContext()
+ if c.IsSet("timeout") {
+ timeout = int(c.Uint("timeout"))
+ }
for _, pod := range pods {
// set cleanup to true to clean mounts and namespaces
- ctr_errs, err := pod.Stop(ctx, true)
+ ctr_errs, err := pod.StopWithTimeout(ctx, true, timeout)
if ctr_errs != nil {
for ctr, err := range ctr_errs {
if lastError != nil {