forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
specgen/generate: Factor out setting resource limits from CompleteSpec
This avoids setting values in the spec which are not supported on FreeBSD - including these values causes warning messages for the unsupported features. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <[email protected]>
- Loading branch information
Showing
3 changed files
with
31 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package specgen | ||
|
||
import ( | ||
"github.com/containers/common/pkg/config" | ||
) | ||
|
||
func (s *SpecGenerator) InitResourceLimits(rtc *config.Config) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package specgen | ||
|
||
import ( | ||
"github.com/containers/common/pkg/config" | ||
spec "github.com/opencontainers/runtime-spec/specs-go" | ||
) | ||
|
||
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, | ||
} | ||
} | ||
} | ||
} | ||
} |