Skip to content

Commit

Permalink
cgroups: rename addCpuQuota() to addCPUQuota()
Browse files Browse the repository at this point in the history
Fix lint-extra err:

    Warning: var-naming: func addCpuQuota should be addCPUQuota (revive)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
  • Loading branch information
metux committed Aug 25, 2023
1 parent 23ddbc0 commit 203096c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libcontainer/cgroups/systemd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func systemdVersionAtoi(str string) (int, error) {
return ver, nil
}

func addCpuQuota(cm *dbusConnManager, properties *configs.SdProperties, quota int64, period uint64) {
func addCPUQuota(cm *dbusConnManager, properties *configs.SdProperties, quota int64, period uint64) {
if period != 0 {
// systemd only supports CPUQuotaPeriodUSec since v242
sdVer := systemdVersion(cm)
Expand Down
2 changes: 1 addition & 1 deletion libcontainer/cgroups/systemd/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func genV1ResourcesProperties(r *configs.Resources, cm *dbusConnManager) (config
newProp("CPUShares", r.CpuShares))
}

addCpuQuota(cm, &properties, r.CpuQuota, r.CpuPeriod)
addCPUQuota(cm, &properties, r.CpuQuota, r.CpuPeriod)

if r.BlkioWeight != 0 {
properties = append(properties,
Expand Down
6 changes: 3 additions & 3 deletions libcontainer/cgroups/systemd/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func unifiedResToSystemdProps(cm *dbusConnManager, res map[string]string) (props

case "cpu.max":
// value: quota [period]
quota := int64(0) // 0 means "unlimited" for addCpuQuota, if period is set
quota := int64(0) // 0 means "unlimited" for addCPUQuota, if period is set
period := defCPUQuotaPeriod
sv := strings.Fields(v)
if len(sv) < 1 || len(sv) > 2 {
Expand All @@ -116,7 +116,7 @@ func unifiedResToSystemdProps(cm *dbusConnManager, res map[string]string) (props
return nil, fmt.Errorf("unified resource %q quota value conversion error: %w", k, err)
}
}
addCpuQuota(cm, &props, quota, period)
addCPUQuota(cm, &props, quota, period)

case "cpu.weight":
if shouldSetCPUIdle(cm, strings.TrimSpace(res["cpu.idle"])) {
Expand Down Expand Up @@ -257,7 +257,7 @@ func genV2ResourcesProperties(dirPath string, r *configs.Resources, cm *dbusConn
}
}

addCpuQuota(cm, &properties, r.CpuQuota, r.CpuPeriod)
addCPUQuota(cm, &properties, r.CpuQuota, r.CpuPeriod)

if r.PidsLimit > 0 || r.PidsLimit == -1 {
properties = append(properties,
Expand Down

0 comments on commit 203096c

Please sign in to comment.