summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-06 17:15:26 -0400
committerGitHub <noreply@github.com>2020-07-06 17:15:26 -0400
commit1a93857acc4ee1e5a9213e2c22f12802d84cd277 (patch)
treed3f8c923e0750fa4aa5ed423dca52640a8ff187c /libpod/container_internal.go
parentb1cc781c68964dff3ee4a00ef7ce71f56ae69e7c (diff)
parent10ad46eb7377ff504a65783a7a604b248b50f20a (diff)
downloadpodman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.tar.gz
podman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.tar.bz2
podman-1a93857acc4ee1e5a9213e2c22f12802d84cd277.zip
Merge pull request #6693 from goochjj/libpod-sd-notify-cmdline
Implement --sdnotify cmdline option to control sd-notify behavior
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 7a547e565..12132cf41 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -24,6 +24,7 @@ import (
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/mount"
+ "github.com/coreos/go-systemd/v22/daemon"
securejoin "github.com/cyphar/filepath-securejoin"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
@@ -1192,6 +1193,19 @@ func (c *Container) start() error {
c.state.State = define.ContainerStateRunning
+ if c.config.SdNotifyMode != define.SdNotifyModeIgnore {
+ payload := fmt.Sprintf("MAINPID=%d", c.state.ConmonPID)
+ if c.config.SdNotifyMode == define.SdNotifyModeConmon {
+ payload += "\n"
+ payload += daemon.SdNotifyReady
+ }
+ if sent, err := daemon.SdNotify(false, payload); err != nil {
+ logrus.Errorf("Error notifying systemd of Conmon PID: %s", err.Error())
+ } else if sent {
+ logrus.Debugf("Notify sent successfully")
+ }
+ }
+
if c.config.HealthCheckConfig != nil {
if err := c.updateHealthStatus(define.HealthCheckStarting); err != nil {
logrus.Error(err)