mirror of
https://github.com/containers/podman.git
synced 2025-12-11 01:11:30 +08:00
Pids-limit should only be set if the user set it
Currently we are sending over pids-limits from the user even if they never modified the defaults. The pids limit should be set at the server side unless modified by the user. This issue has led to failures on systems that were running with cgroups V1. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
envLib "github.com/containers/libpod/v2/pkg/env"
|
||||
"github.com/containers/libpod/v2/pkg/signal"
|
||||
"github.com/containers/libpod/v2/pkg/specgen"
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@@ -169,6 +170,21 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
|
||||
}
|
||||
}
|
||||
|
||||
// If caller did not specify Pids Limits load default
|
||||
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 verifyContainerResources(s)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user