mirror of
https://github.com/containers/podman.git
synced 2025-10-17 19:24:04 +08:00
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
This commit is contained in:

committed by
Atomic Bot

parent
3607fcb553
commit
1f49f555af
@ -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())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user