summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-09-16 12:14:02 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-09-17 10:37:59 +0200
commitae5a5b51b068f62c8ec71bb9ec555d2c5c5f4f37 (patch)
tree276d3c7d1297ff52224169413e1f2fe23c46a7ee /pkg/domain
parent34c9ce2ec91ac1ada9de0cc644f8870aaf190889 (diff)
downloadpodman-ae5a5b51b068f62c8ec71bb9ec555d2c5c5f4f37.tar.gz
podman-ae5a5b51b068f62c8ec71bb9ec555d2c5c5f4f37.tar.bz2
podman-ae5a5b51b068f62c8ec71bb9ec555d2c5c5f4f37.zip
system: always move pause process when running on systemd
when running on a systemd with systemd, always try to move the pause process to its own scope. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> (cherry picked from commit 9c1e27fdd536f6026efe3da4360755a3e9135ca8)
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/infra/abi/system.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 0f7492354..7140618bb 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -9,7 +9,6 @@ import (
"os/exec"
"path/filepath"
"strconv"
- "strings"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/libpod/define"
@@ -71,11 +70,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool)
if err != nil {
return err
}
-
- initCommand, err := ioutil.ReadFile("/proc/1/comm")
- // On errors, default to systemd
- runsUnderSystemd := err != nil || strings.TrimRight(string(initCommand), "\n") == "systemd"
-
+ runsUnderSystemd := utils.RunsOnSystemd()
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
@@ -121,11 +116,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool)
became, ret, err = rootless.TryJoinFromFilePaths(pausePidPath, true, paths)
if err := movePauseProcessToScope(pausePidPath); err != nil {
- conf, err2 := ic.Config(context.Background())
- if err2 != nil {
- return err
- }
- if conf.Engine.CgroupManager == config.SystemdCgroupsManager {
+ if utils.RunsOnSystemd() {
logrus.Warnf("Failed to add pause process to systemd sandbox cgroup: %v", err)
} else {
logrus.Debugf("Failed to add pause process to systemd sandbox cgroup: %v", err)