summaryrefslogtreecommitdiff
path: root/libpod/container.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/container.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/container.go')
-rw-r--r--libpod/container.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index dc22c9c61..158bf7529 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -146,6 +146,8 @@ type ContainerConfig struct {
Mounts []string `json:"mounts,omitempty"`
// StopSignal is the signal that will be used to stop the container
StopSignal uint `json:"stopSignal,omitempty"`
+ // StopTimeout is the signal that will be used to stop the container
+ StopTimeout uint `json:"stopTimeout,omitempty"`
// Shared namespaces with container
SharedNamespaceCtr *string `json:"shareNamespacesWith,omitempty"`
SharedNamespaceMap map[string]string `json:"sharedNamespaces"`
@@ -671,9 +673,10 @@ func (c *Container) Start() error {
// to stop the container, and if it has not stopped after the given timeout (in
// seconds), uses SIGKILL to attempt to forcibly stop the container.
// If timeout is 0, SIGKILL will be used immediately
-func (c *Container) Stop(timeout int64) error {
+func (c *Container) Stop(timeout uint) error {
c.lock.Lock()
defer c.lock.Unlock()
+ logrus.Debugf("Stopping ctr %s with timeout %d", c.ID(), timeout)
if err := c.syncContainer(); err != nil {
return err
@@ -1140,3 +1143,8 @@ func (c *Container) copyHostFileToRundir(sourcePath string) (string, error) {
}
return destFileName, nil
}
+
+// StopTimeout returns a stop timeout field for this container
+func (c *Container) StopTimeout() uint {
+ return c.config.StopTimeout
+}