diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-17 11:39:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 11:39:37 +0100 |
commit | 802f26ef1039ea3a95c54fce53ea2ed99822e1c3 (patch) | |
tree | 83a2706db6a84b5db078645bf914f1b5eb9ea8d6 /utils/utils.go | |
parent | c6616648780881ac717817cf79de84084ce7c02f (diff) | |
parent | ee62711136339c5daf38e38859227d85b06fc32a (diff) | |
download | podman-802f26ef1039ea3a95c54fce53ea2ed99822e1c3.tar.gz podman-802f26ef1039ea3a95c54fce53ea2ed99822e1c3.tar.bz2 podman-802f26ef1039ea3a95c54fce53ea2ed99822e1c3.zip |
Merge pull request #12323 from giuseppe/utils-not-unique-pause-scope-name
utils: use podman-pause-$RANDOM.scope name
Diffstat (limited to 'utils/utils.go')
-rw-r--r-- | utils/utils.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/utils/utils.go b/utils/utils.go index 109ae088b..f2e7beef9 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "io/ioutil" + "math/rand" "os" "os/exec" "strconv" @@ -203,7 +204,16 @@ func moveProcessToScope(pidPath, slice, scope string) error { // MovePauseProcessToScope moves the pause process used for rootless mode to keep the namespaces alive to // a separate scope. func MovePauseProcessToScope(pausePidPath string) { - err := moveProcessToScope(pausePidPath, "user.slice", "podman-pause.scope") + var err error + + for i := 0; i < 3; i++ { + r := rand.Int() + err = moveProcessToScope(pausePidPath, "user.slice", fmt.Sprintf("podman-pause-%d.scope", r)) + if err == nil { + return + } + } + if err != nil { unified, err2 := cgroups.IsCgroup2UnifiedMode() if err2 != nil { |