From 6c950bdb40f5df2a1925c8d2103713a6e3c3ff84 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 1 Apr 2025 10:51:39 -0700 Subject: [PATCH] Remove unused code and data structures No change in functionality. I might be missing something here, but it appears to be unfinished and unused. Fixes: bbd085ad1e ("Podman Pod Create --cpus and --cpuset-cpus flags") Fixes: 2d86051893 ("Pod Device-Read-BPS support") Signed-off-by: Kir Kolyshkin --- pkg/domain/entities/pods.go | 25 ++++++------------------- pkg/specgen/podspecgen.go | 6 ------ 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index 0218378d92..9edf5aca4a 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -291,22 +291,16 @@ type PodCreateReport = types.PodCreateReport type PodCloneReport = types.PodCloneReport func (p *PodCreateOptions) CPULimits() *specs.LinuxCPU { - cpu := &specs.LinuxCPU{} - hasLimits := false + cpu := &specs.LinuxCPU{ + Cpus: p.CpusetCpus, + } 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 } @@ -380,18 +374,11 @@ func ToPodSpecGen(s specgen.PodSpecGenerator, p *PodCreateOptions) (*specgen.Pod 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 - } } + s.ResourceLimits.CPU = p.CPULimits() + s.Userns = p.Userns sysctl := map[string]string{} if ctl := p.Sysctl; len(ctl) > 0 { diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go index 9aef3ea5a6..6a7f47b5e9 100644 --- a/pkg/specgen/podspecgen.go +++ b/pkg/specgen/podspecgen.go @@ -248,12 +248,6 @@ type PodSpecGenerator struct { 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"` - // ThrottleReadBpsDevice contains the rate at which the devices in the pod can be read from/accessed - ThrottleReadBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"` } type PodSecurityConfig struct {