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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-04-01 10:51:39 -07:00
parent 4b2472595c
commit 6c950bdb40
2 changed files with 6 additions and 25 deletions

View File

@ -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 = &quota
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 {

View File

@ -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 {