diff options
author | Matthew Heon <matthew.heon@pm.me> | 2021-08-11 14:38:02 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-08-11 15:28:18 -0400 |
commit | 7442f0b858e5fe2d7922b3b5714030fda5b2646e (patch) | |
tree | d54633e92f854dfe9f5e0e0361e46e35c2dcfe7d /pkg | |
parent | 61a5e981276cca57d604108d19bcfa1beae2f271 (diff) | |
download | podman-7442f0b858e5fe2d7922b3b5714030fda5b2646e.tar.gz podman-7442f0b858e5fe2d7922b3b5714030fda5b2646e.tar.bz2 podman-7442f0b858e5fe2d7922b3b5714030fda5b2646e.zip |
Revert "Podman Pod Create --cpus and --cpuset-cpus flags"
This reverts commit bbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34.
The cgroup work to enable these has not happened yet and will not
be ready in time for the release of Podman 3.3.0.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/entities/pods.go | 37 | ||||
-rw-r--r-- | pkg/specgen/generate/container_create.go | 1 | ||||
-rw-r--r-- | pkg/specgen/generate/pod_create.go | 8 | ||||
-rw-r--r-- | pkg/specgen/podspecgen.go | 12 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 4 |
5 files changed, 1 insertions, 61 deletions
diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index 68e335f8d..abd6ba6c6 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -7,8 +7,6 @@ import ( "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/pkg/specgen" - "github.com/containers/podman/v3/pkg/util" - "github.com/opencontainers/runtime-spec/specs-go" ) type PodKillOptions struct { @@ -120,34 +118,12 @@ type PodCreateOptions struct { Net *NetOptions Share []string Pid string - Cpus float64 - CpusetCpus string } type PodCreateReport struct { Id string //nolint } -func (p *PodCreateOptions) CPULimits() *specs.LinuxCPU { - cpu := &specs.LinuxCPU{} - hasLimits := false - - if p.Cpus != 0 { - period, quota := util.CoresToPeriodAndQuota(p.Cpus) - cpu.Period = &period - cpu.Quota = "a - hasLimits = true - } - if p.CpusetCpus != "" { - cpu.Cpus = p.CpusetCpus - hasLimits = true - } - if !hasLimits { - return cpu - } - return cpu -} - func setNamespaces(p *PodCreateOptions) ([4]specgen.Namespace, error) { allNS := [4]specgen.Namespace{} if p.Pid != "" { @@ -204,19 +180,6 @@ func (p *PodCreateOptions) ToPodSpecGen(s *specgen.PodSpecGenerator) error { // Cgroup s.CgroupParent = p.CGroupParent - // Resource config - cpuDat := p.CPULimits() - if s.ResourceLimits == nil { - s.ResourceLimits = &specs.LinuxResources{} - s.ResourceLimits.CPU = &specs.LinuxCPU{} - } - if cpuDat != nil { - s.ResourceLimits.CPU = cpuDat - if p.Cpus != 0 { - s.CPUPeriod = *cpuDat.Period - s.CPUQuota = *cpuDat.Quota - } - } return nil } diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 4e3a86ae4..2961ed849 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -354,6 +354,7 @@ 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 aab29499e..ec3ea077e 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -54,14 +54,6 @@ 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)) } diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go index 02237afe9..b2d284f40 100644 --- a/pkg/specgen/podspecgen.go +++ b/pkg/specgen/podspecgen.go @@ -2,8 +2,6 @@ package specgen import ( "net" - - spec "github.com/opencontainers/runtime-spec/specs-go" ) // PodBasicConfig contains basic configuration options for pods. @@ -167,16 +165,6 @@ type PodSpecGenerator struct { PodBasicConfig PodNetworkConfig PodCgroupConfig - PodResourceConfig -} - -type PodResourceConfig struct { - // ResourceLimits contains linux specific CPU data for the pod - ResourceLimits *spec.LinuxResources `json:"resource_limits,omitempty"` - // CPU period of the cpuset, determined by --cpus - CPUPeriod uint64 `json:"cpu_period,omitempty"` - // CPU quota of the cpuset, determined by --cpus - CPUQuota int64 `json:"cpu_quota,omitempty"` } // NewPodSpecGenerator creates a new pod spec diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 7eec48a55..1e0a952de 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -473,10 +473,6 @@ type ContainerResourceConfig struct { // that are used to configure cgroup v2. // Optional. CgroupConf map[string]string `json:"unified,omitempty"` - // CPU period of the cpuset, determined by --cpus - CPUPeriod uint64 `json:"cpu_period,omitempty"` - // CPU quota of the cpuset, determined by --cpus - CPUQuota int64 `json:"cpu_quota,omitempty"` } // ContainerHealthCheckConfig describes a container healthcheck with attributes |