Merge pull request from afbjorklund/gopsutil-cpu

The gopsutil cpu implementation changed in v3
pull/10273/head
Medya Ghazizadeh 2021-01-26 12:53:38 -08:00 committed by GitHub
commit a1e7799db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions
cmd/minikube/cmd
pkg/minikube/machine

View File

@ -979,8 +979,8 @@ func validateCPUCount(drvName string) {
var cpuCount int var cpuCount int
if driver.BareMetal(drvName) { if driver.BareMetal(drvName) {
// Uses the gopsutil cpu package to count the number of physical cpu cores // Uses the gopsutil cpu package to count the number of logical cpu cores
ci, err := cpu.Counts(false) ci, err := cpu.Counts(true)
if err != nil { if err != nil {
klog.Warningf("Unable to get CPU info: %v", err) klog.Warningf("Unable to get CPU info: %v", err)
} else { } else {

View File

@ -181,6 +181,7 @@ var (
// cachedCPUInfo will return a cached cpu info // cachedCPUInfo will return a cached cpu info
func cachedCPUInfo() ([]cpu.InfoStat, error) { func cachedCPUInfo() ([]cpu.InfoStat, error) {
if cachedCPU == nil { if cachedCPU == nil {
// one InfoStat per thread
i, err := cpu.Info() i, err := cpu.Info()
cachedCPU = &i cachedCPU = &i
cachedCPUErr = &err cachedCPUErr = &err