summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/pods.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-08-23 17:49:47 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-08-24 10:50:16 +0200
commit70801b3d714b067d64744697433c5841926dad4d (patch)
tree7c32b2fb385ddc6a7296edd6609f9526d8df20c3 /pkg/systemd/generate/pods.go
parenteb9d731c68266cd0953b0669f2bc6340aa8df288 (diff)
downloadpodman-70801b3d714b067d64744697433c5841926dad4d.tar.gz
podman-70801b3d714b067d64744697433c5841926dad4d.tar.bz2
podman-70801b3d714b067d64744697433c5841926dad4d.zip
generate systemd: custom stop signal
Commit 9ac5267598c3 changed the type of the generated systemd units from forking to notify. Parts of these changes was also removing the need to pass any information via the file system (e.g., PIDFILE, container ID). That in turn implies that systemd takes care of stopping the container. By default, systemd first sends a SIGTERM and after a certain timeout, it'll send a SIGKILL. That's pretty much what Podman is doing, unless the container was created with a custom stop signal which is the case when the --stop-signal flag was used or systemd is mounted. Account for that by using systemd's KillSignal option which allows for changing SIGTERM to another signal. Also make sure that we're using the correct timeout for units generated with --new. Fixes: #11304 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate/pods.go')
-rw-r--r--pkg/systemd/generate/pods.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go
index 1b92649e8..d49828884 100644
--- a/pkg/systemd/generate/pods.go
+++ b/pkg/systemd/generate/pods.go
@@ -323,7 +323,7 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions)
info.ExecStop = "{{{{.Executable}}}} {{{{if .RootFlags}}}}{{{{ .RootFlags}}}} {{{{end}}}}pod stop --ignore --pod-id-file {{{{.PodIDFile}}}} {{{{if (ge .StopTimeout 0)}}}}-t {{{{.StopTimeout}}}}{{{{end}}}}"
info.ExecStopPost = "{{{{.Executable}}}} {{{{if .RootFlags}}}}{{{{ .RootFlags}}}} {{{{end}}}}pod rm --ignore -f --pod-id-file {{{{.PodIDFile}}}}"
}
- info.TimeoutStopSec = minTimeoutStopSec + info.StopTimeout
+ info.TimeoutStopSec = info.StopTimeout
if info.PodmanVersion == "" {
info.PodmanVersion = version.Version.String()