summaryrefslogtreecommitdiff
path: root/cmd/podman/common/create_opts.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-04 15:18:53 -0500
committerGitHub <noreply@github.com>2021-03-04 15:18:53 -0500
commit4e5cc6a3a61d9d2f1d3b97fc10684ec5617816ab (patch)
treedb4260214b8dcc0e82c00b088772c47c3a8fde1f /cmd/podman/common/create_opts.go
parenta26b15265e6361647a99876ca698986b25296179 (diff)
parent8453424e2cfbe54b204b6fdb3515ea9f7f001023 (diff)
downloadpodman-4e5cc6a3a61d9d2f1d3b97fc10684ec5617816ab.tar.gz
podman-4e5cc6a3a61d9d2f1d3b97fc10684ec5617816ab.tar.bz2
podman-4e5cc6a3a61d9d2f1d3b97fc10684ec5617816ab.zip
Merge pull request #9607 from mheon/fix_9523
Respect NanoCpus in Compat Create
Diffstat (limited to 'cmd/podman/common/create_opts.go')
-rw-r--r--cmd/podman/common/create_opts.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 03cd8a721..6c91bedfe 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -397,6 +397,13 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
cliOpts.Ulimit = ulimits
}
}
+ if cc.HostConfig.Resources.NanoCPUs > 0 {
+ if cliOpts.CPUPeriod != 0 || cliOpts.CPUQuota != 0 {
+ return nil, nil, errors.Errorf("NanoCpus conflicts with CpuPeriod and CpuQuota")
+ }
+ cliOpts.CPUPeriod = 100000
+ cliOpts.CPUQuota = cc.HostConfig.Resources.NanoCPUs / 10000
+ }
// volumes
volSources := make(map[string]bool)