mirror of https://github.com/containers/podman.git
Merge pull request #12538 from giuseppe/fix-12535
utils: reintroduce moveToCgroup
This commit is contained in:
commit
31be3a9f24
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue