diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-07-23 01:35:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-23 01:35:58 +0200 |
commit | da1f47921685f40f1b26405278cbf9cb2d06fe09 (patch) | |
tree | 598374f4839b1fd171b20704b929af16c199d9b1 /pkg/specgenutil/specgen.go | |
parent | 935c150ee214e689b8f25c195ecc22af12d1ddc7 (diff) | |
parent | ad8940cecff20426120bc8eabff50e734ad7b765 (diff) | |
download | podman-da1f47921685f40f1b26405278cbf9cb2d06fe09.tar.gz podman-da1f47921685f40f1b26405278cbf9cb2d06fe09.tar.bz2 podman-da1f47921685f40f1b26405278cbf9cb2d06fe09.zip |
Merge pull request #15035 from cdoern/cgroup
fix container create/run throttle devices
Diffstat (limited to 'pkg/specgenutil/specgen.go')
-rw-r--r-- | pkg/specgenutil/specgen.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go index 4ab019b5b..7392e7b44 100644 --- a/pkg/specgenutil/specgen.go +++ b/pkg/specgenutil/specgen.go @@ -77,11 +77,11 @@ func getIOLimits(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions) ( if s.ResourceLimits == nil { s.ResourceLimits = &specs.LinuxResources{} } - if s.ResourceLimits.BlockIO == nil { - s.ResourceLimits.BlockIO = &specs.LinuxBlockIO{} - } hasLimits := false if b := c.BlkIOWeight; len(b) > 0 { + if s.ResourceLimits.BlockIO == nil { + s.ResourceLimits.BlockIO = &specs.LinuxBlockIO{} + } u, err := strconv.ParseUint(b, 10, 16) if err != nil { return nil, fmt.Errorf("invalid value for blkio-weight: %w", err) @@ -103,7 +103,6 @@ func getIOLimits(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions) ( if s.ThrottleReadBpsDevice, err = parseThrottleBPSDevices(bps); err != nil { return nil, err } - hasLimits = true } @@ -131,8 +130,6 @@ func getIOLimits(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions) ( if !hasLimits { return nil, nil } - io = s.ResourceLimits.BlockIO - return io, nil } |