diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-09-16 12:44:45 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-09-17 10:38:00 +0200 |
commit | e6fe5d6312e1569b688baeb1aa1cee3030921076 (patch) | |
tree | a9f22978d31d48f8a7f1695521c9e68bae3f9e82 /pkg | |
parent | ae5a5b51b068f62c8ec71bb9ec555d2c5c5f4f37 (diff) | |
download | podman-e6fe5d6312e1569b688baeb1aa1cee3030921076.tar.gz podman-e6fe5d6312e1569b688baeb1aa1cee3030921076.tar.bz2 podman-e6fe5d6312e1569b688baeb1aa1cee3030921076.zip |
system: move MovePauseProcessToScope to utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 72534a74b3c2ff35ae1711a890406a6bce5fa44f)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/infra/abi/system.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index 7140618bb..e326f26a8 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -3,12 +3,10 @@ package abi import ( "context" "fmt" - "io/ioutil" "net/url" "os" "os/exec" "path/filepath" - "strconv" "github.com/containers/common/pkg/config" "github.com/containers/podman/v3/libpod/define" @@ -114,14 +112,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool) } became, ret, err = rootless.TryJoinFromFilePaths(pausePidPath, true, paths) - - if err := movePauseProcessToScope(pausePidPath); err != nil { - 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) - } - } + utils.MovePauseProcessToScope(pausePidPath) if err != nil { logrus.Error(errors.Wrapf(err, "invalid internal status, try resetting the pause process with %q", os.Args[0]+" system migrate")) os.Exit(1) @@ -132,19 +123,6 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool) return nil } -func movePauseProcessToScope(pausePidPath string) error { - data, err := ioutil.ReadFile(pausePidPath) - if err != nil { - return errors.Wrapf(err, "cannot read pause pid file") - } - pid, err := strconv.ParseUint(string(data), 10, 0) - if err != nil { - return errors.Wrapf(err, "cannot parse pid file %s", pausePidPath) - } - - return utils.RunUnderSystemdScope(int(pid), "user.slice", "podman-pause.scope") -} - // SystemPrune removes unused data from the system. Pruning pods, containers, volumes and images. func (ic *ContainerEngine) SystemPrune(ctx context.Context, options entities.SystemPruneOptions) (*entities.SystemPruneReport, error) { var systemPruneReport = new(entities.SystemPruneReport) |