Skip to content

Commit 6c950bd

Browse files
committed
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: bbd085a ("Podman Pod Create --cpus and --cpuset-cpus flags") Fixes: 2d86051 ("Pod Device-Read-BPS support") Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 4b24725 commit 6c950bd

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

pkg/domain/entities/pods.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,16 @@ type PodCreateReport = types.PodCreateReport
291291
type PodCloneReport = types.PodCloneReport
292292

293293
func (p *PodCreateOptions) CPULimits() *specs.LinuxCPU {
294-
cpu := &specs.LinuxCPU{}
295-
hasLimits := false
294+
cpu := &specs.LinuxCPU{
295+
Cpus: p.CpusetCpus,
296+
}
296297

297298
if p.Cpus != 0 {
298299
period, quota := util.CoresToPeriodAndQuota(p.Cpus)
299300
cpu.Period = &period
300301
cpu.Quota = &quota
301-
hasLimits = true
302-
}
303-
if p.CpusetCpus != "" {
304-
cpu.Cpus = p.CpusetCpus
305-
hasLimits = true
306-
}
307-
if !hasLimits {
308-
return cpu
309302
}
303+
310304
return cpu
311305
}
312306

@@ -380,18 +374,11 @@ func ToPodSpecGen(s specgen.PodSpecGenerator, p *PodCreateOptions) (*specgen.Pod
380374
s.CgroupParent = p.CgroupParent
381375

382376
// Resource config
383-
cpuDat := p.CPULimits()
384377
if s.ResourceLimits == nil {
385378
s.ResourceLimits = &specs.LinuxResources{}
386-
s.ResourceLimits.CPU = &specs.LinuxCPU{}
387-
}
388-
if cpuDat != nil {
389-
s.ResourceLimits.CPU = cpuDat
390-
if p.Cpus != 0 {
391-
s.CPUPeriod = *cpuDat.Period
392-
s.CPUQuota = *cpuDat.Quota
393-
}
394379
}
380+
s.ResourceLimits.CPU = p.CPULimits()
381+
395382
s.Userns = p.Userns
396383
sysctl := map[string]string{}
397384
if ctl := p.Sysctl; len(ctl) > 0 {

pkg/specgen/podspecgen.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,6 @@ type PodSpecGenerator struct {
248248
type PodResourceConfig struct {
249249
// ResourceLimits contains linux specific CPU data for the pod
250250
ResourceLimits *spec.LinuxResources `json:"resource_limits,omitempty"`
251-
// CPU period of the cpuset, determined by --cpus
252-
CPUPeriod uint64 `json:"cpu_period,omitempty"`
253-
// CPU quota of the cpuset, determined by --cpus
254-
CPUQuota int64 `json:"cpu_quota,omitempty"`
255-
// ThrottleReadBpsDevice contains the rate at which the devices in the pod can be read from/accessed
256-
ThrottleReadBpsDevice map[string]spec.LinuxThrottleDevice `json:"throttleReadBpsDevice,omitempty"`
257251
}
258252

259253
type PodSecurityConfig struct {

0 commit comments

Comments
 (0)