summaryrefslogtreecommitdiff
path: root/cmd/podman/common/specgen.go
diff options
context:
space:
mode:
authorJordan Christiansen <xordspar0@gmail.com>2020-10-31 09:32:52 -0500
committerJordan Christiansen <xordspar0@gmail.com>2020-10-31 10:07:11 -0500
commit03579649063d669f9f57d534f74136befef98c62 (patch)
tree3b2d9d5e5e52c46c53d6e5b9c439f26067f9a0b2 /cmd/podman/common/specgen.go
parent2aaa036f560e2c42ebb033869eeef539dbc47fef (diff)
downloadpodman-03579649063d669f9f57d534f74136befef98c62.tar.gz
podman-03579649063d669f9f57d534f74136befef98c62.tar.bz2
podman-03579649063d669f9f57d534f74136befef98c62.zip
Centralize cores and period/quota conversion code
Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r--cmd/podman/common/specgen.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index bd3e5fafd..ca1e25be1 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -25,11 +25,8 @@ func getCPULimits(c *ContainerCLIOpts) *specs.LinuxCPU {
cpu := &specs.LinuxCPU{}
hasLimits := false
- const cpuPeriod = 100000
-
if c.CPUS > 0 {
- quota := int64(c.CPUS * cpuPeriod)
- period := uint64(cpuPeriod)
+ period, quota := util.CoresToPeriodAndQuota(c.CPUS)
cpu.Period = &period
cpu.Quota = &quota