summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-23 15:51:29 -0400
committerGitHub <noreply@github.com>2021-06-23 15:51:29 -0400
commit3f3feaa015af6e0831daf039f1cd5a0cba3de6c2 (patch)
tree0bc3c003a0546e89006159030f35031931a832fd /pkg/specgen/generate
parentb0a3ac35785fca1a054d236937c86cce85631585 (diff)
parentbbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34 (diff)
downloadpodman-3f3feaa015af6e0831daf039f1cd5a0cba3de6c2.tar.gz
podman-3f3feaa015af6e0831daf039f1cd5a0cba3de6c2.tar.bz2
podman-3f3feaa015af6e0831daf039f1cd5a0cba3de6c2.zip
Merge pull request #10716 from cdoern/podFlags
Podman Pod Create --cpus and --cpuset-cpus flags
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r--pkg/specgen/generate/container_create.go1
-rw-r--r--pkg/specgen/generate/pod_create.go8
2 files changed, 8 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 087ff59df..e2901f0b6 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -347,7 +347,6 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
options = append(options, libpod.WithLogDriver(s.LogConfiguration.Driver))
}
}
-
// Security options
if len(s.SelinuxOpts) > 0 {
options = append(options, libpod.WithSecLabels(s.SelinuxOpts))
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index 07c56b799..023ebb41e 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -54,6 +54,14 @@ func createPodOptions(p *specgen.PodSpecGenerator, rt *libpod.Runtime) ([]libpod
if len(p.Name) > 0 {
options = append(options, libpod.WithPodName(p.Name))
}
+ if p.ResourceLimits != nil && p.ResourceLimits.CPU != nil && p.ResourceLimits.CPU.Period != nil && p.ResourceLimits.CPU.Quota != nil {
+ if *p.ResourceLimits.CPU.Period != 0 || *p.ResourceLimits.CPU.Quota != 0 {
+ options = append(options, libpod.WithPodCPUPAQ((*p.ResourceLimits.CPU.Period), (*p.ResourceLimits.CPU.Quota)))
+ }
+ }
+ if p.ResourceLimits != nil && p.ResourceLimits.CPU != nil && p.ResourceLimits.CPU.Cpus != "" {
+ options = append(options, libpod.WithPodCPUSetCPUs(p.ResourceLimits.CPU.Cpus))
+ }
if len(p.Hostname) > 0 {
options = append(options, libpod.WithPodHostname(p.Hostname))
}