mirror of
https://github.com/containers/podman.git
synced 2026-11-08 17:12:52 -05:00
Same failure #29910 fixed for create: with no pids limit to lift, there is nothing to change, and the controller is often not delegated. Signed-off-by: Victor Irzak <victor.irzak@zomp.com>
30 lines
704 B
Go
30 lines
704 B
Go
package specgen
|
|
|
|
import (
|
|
spec "github.com/opencontainers/runtime-spec/specs-go"
|
|
"go.podman.io/common/pkg/config"
|
|
"go.podman.io/podman/v6/pkg/util"
|
|
)
|
|
|
|
func (s *SpecGenerator) InitResourceLimits(rtc *config.Config) {
|
|
if s.ResourceLimits == nil || s.ResourceLimits.Pids == nil {
|
|
if s.CgroupsMode != "disabled" {
|
|
limit := rtc.PidsLimit()
|
|
if limit != 0 {
|
|
if s.ResourceLimits == nil {
|
|
s.ResourceLimits = &spec.LinuxResources{}
|
|
}
|
|
s.ResourceLimits.Pids = &spec.LinuxPids{
|
|
Limit: &limit,
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// A new cgroup has no pids limit anyway.
|
|
if util.SkipUnlimitedPids(s.ResourceLimits.Pids.Limit, rtc.Engine.CgroupManager) {
|
|
s.ResourceLimits.Pids = nil
|
|
}
|
|
}
|