summaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-12-19 15:42:30 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-20 18:10:43 +0000
commit1f49f555af0709ea7c12becdb750ba60a00eaf1d (patch)
tree9a39b8d0b61ff8d4cb88619ad49bd229320e952c /libpod/runtime_ctr.go
parent3607fcb553046b9a51c4b591ddf20236c628dc57 (diff)
downloadpodman-1f49f555af0709ea7c12becdb750ba60a00eaf1d.tar.gz
podman-1f49f555af0709ea7c12becdb750ba60a00eaf1d.tar.bz2
podman-1f49f555af0709ea7c12becdb750ba60a00eaf1d.zip
Plumb through the --stop-timeout signal handling
podman run/create have the ability to set the stop timeout flag. We need to stop it in the database. Also Allowing negative time for stop timeout makes no sense, so switching to timeout of uint, allows user to specify huge timeout values. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #158 Approved by: TomSweeneyRedHat
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 320821b38..1f2b8945e 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -9,7 +9,9 @@ import (
"github.com/sirupsen/logrus"
)
-const ctrRemoveTimeout = 10
+// CtrRemoveTimeout is the default number of seconds to wait after stopping a container
+// before sending the kill signal
+const CtrRemoveTimeout = 10
// Contains the public Runtime API for containers
@@ -34,6 +36,7 @@ func (r *Runtime) NewContainer(spec *spec.Spec, options ...CtrCreateOption) (c *
if err != nil {
return nil, err
}
+ ctr.config.StopTimeout = CtrRemoveTimeout
for _, option := range options {
if err := option(ctr); err != nil {
@@ -122,7 +125,7 @@ func (r *Runtime) removeContainer(c *Container, force bool) error {
// Check that the container's in a good state to be removed
if c.state.State == ContainerStateRunning && force {
- if err := r.ociRuntime.stopContainer(c, ctrRemoveTimeout); err != nil {
+ if err := r.ociRuntime.stopContainer(c, c.StopTimeout()); err != nil {
return errors.Wrapf(err, "cannot remove container %s as it could not be stopped", c.ID())
}