summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/containers.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-08-24 13:33:00 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-08-24 13:33:06 +0200
commit74ab2aaf9f27e1495a74c37932a634c82af9a57b (patch)
tree8b9f83168bfcdac85572b2ea49dc711547a5aa85 /pkg/systemd/generate/containers.go
parente20ec47a59b4ac65d42f3fee7b8b7ec5760ea35d (diff)
downloadpodman-74ab2aaf9f27e1495a74c37932a634c82af9a57b.tar.gz
podman-74ab2aaf9f27e1495a74c37932a634c82af9a57b.tar.bz2
podman-74ab2aaf9f27e1495a74c37932a634c82af9a57b.zip
Revert "generate systemd: custom stop signal"
This reverts commit 70801b3d714b067d64744697433c5841926dad4d. It turns out that letting systemd handle stopping the container is not working as I thought it will. Conmon is receiving the stop/kill signals and may exit non-zero, which in turn lets the systemd service transition into the `failed` state. We need to get back to letting Podman stop the containers and do a partial revert of commit 9ac5267 which removed using --cidfile. Happening in a following commit. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r--pkg/systemd/generate/containers.go23
1 files changed, 1 insertions, 22 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index 66cf5ca44..78b81b54b 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -16,7 +16,6 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
- "golang.org/x/sys/unix"
)
// containerInfo contains data required for generating a container's systemd
@@ -33,8 +32,6 @@ type containerInfo struct {
// StopTimeout sets the timeout Podman waits before killing the container
// during service stop.
StopTimeout uint
- // KillSignal of the container.
- KillSignal string
// RestartPolicy of the systemd unit (e.g., no, on-failure, always).
RestartPolicy string
// PIDFile of the service. Required for forking services. Must point to the
@@ -105,9 +102,6 @@ Environment={{{{- range $index, $value := .ExtraEnvs -}}}}{{{{if $index}}}} {{{{
{{{{- end}}}}
Restart={{{{.RestartPolicy}}}}
TimeoutStopSec={{{{.TimeoutStopSec}}}}
-{{{{- if .KillSignal}}}}
-KillSignal={{{{.KillSignal}}}}
-{{{{- end}}}}
{{{{- if .ExecStartPre}}}}
ExecStartPre={{{{.ExecStartPre}}}}
{{{{- end}}}}
@@ -190,13 +184,6 @@ func generateContainerInfo(ctr *libpod.Container, options entities.GenerateSyste
containerEnv: envs,
}
- // Set a custom kill signal for non SIGTERM (already default in
- // systemd) signals.
- stopSignal := ctr.StopSignal()
- if stopSignal != uint(unix.SIGTERM) {
- info.KillSignal = fmt.Sprintf("%d", stopSignal)
- }
-
return &info, nil
}
@@ -372,15 +359,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
info.ExecStart = strings.Join(startCommand, " ")
}
- info.TimeoutStopSec = info.StopTimeout
-
- // For units without --new add an additional 60 seconds to the stop
- // timeout to make sure that Podman stop has enough time to properly
- // shutdown and cleanup the container before systemd starts to nuke
- // everything in the cgroup.
- if !options.New {
- info.TimeoutStopSec += minTimeoutStopSec
- }
+ info.TimeoutStopSec = minTimeoutStopSec + info.StopTimeout
if info.PodmanVersion == "" {
info.PodmanVersion = version.Version.String()