mirror of
https://github.com/containers/podman.git
synced 2026-01-25 06:21:08 -05:00
cmd/podman/pods: omit superfluous runtime.NumCPU call
sysinfo.NumCPU already falls back to runtime.NumCPU in case the
platform-specific sysinfo.numCPU returns 0, see
554799639f/pkg/sysinfo/numcpu.go (L8-L13)
Also omit a second call to sysinfo.NumCPU and use the result from the
earlier call.
[NO NEW TESTS NEEDED]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -207,16 +206,13 @@ func create(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
numCPU := sysinfo.NumCPU()
|
||||
if numCPU == 0 {
|
||||
numCPU = runtime.NumCPU()
|
||||
}
|
||||
if createOptions.Cpus > float64(numCPU) {
|
||||
createOptions.Cpus = float64(numCPU)
|
||||
}
|
||||
copy := infraOptions.CPUSetCPUs
|
||||
cpuSet := infraOptions.CPUS
|
||||
if cpuSet == 0 {
|
||||
cpuSet = float64(sysinfo.NumCPU())
|
||||
cpuSet = float64(numCPU)
|
||||
}
|
||||
ret, err := parsers.ParseUintList(copy)
|
||||
copy = ""
|
||||
|
||||
Reference in New Issue
Block a user