diff options
| author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-08 11:44:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-08 11:44:14 +0000 |
| commit | 31be3a9f24597a282a51764c15603311e59e4d44 (patch) | |
| tree | 9a8833e696bf579c168df5719e12ddbb59b4cb45 | |
| parent | 3b21ba2f623da5a4228a6236c684d1d0b245f240 (diff) | |
| parent | 0999245e40b0fd56e98ad7149556d5879646b3ac (diff) | |
| download | podman-31be3a9f24597a282a51764c15603311e59e4d44.tar.gz podman-31be3a9f24597a282a51764c15603311e59e4d44.tar.bz2 podman-31be3a9f24597a282a51764c15603311e59e4d44.zip | |
Merge pull request #12538 from giuseppe/fix-12535
utils: reintroduce moveToCgroup
| -rw-r--r-- | utils/utils_supported.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/utils_supported.go b/utils/utils_supported.go index be200509b..064d9e024 100644 --- a/utils/utils_supported.go +++ b/utils/utils_supported.go @@ -44,6 +44,15 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error { ch := make(chan string) _, err = conn.StartTransientUnit(unitName, "replace", properties, ch) if err != nil { + // On errors check if the cgroup already exists, if it does move the process there + if props, err := conn.GetUnitTypeProperties(unitName, "Scope"); err == nil { + if cgroup, ok := props["ControlGroup"].(string); ok && cgroup != "" { + if err := moveUnderCgroup(cgroup, "", []uint32{uint32(pid)}); err == nil { + return nil + } + // On errors return the original error message we got from StartTransientUnit. + } + } return err } |
