Skip to content

Commit

Permalink
Fixed counting of physical CPU cores
Browse files Browse the repository at this point in the history
Gopsutil packae doesn't automatically return a count of CPU cores, have to use
the Counts function.
  • Loading branch information
MaxKam committed Aug 22, 2019
1 parent 2d763cf commit 6cde7c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,14 @@ func validateConfig() {
out.V{"memory": memorySizeMB, "default_memorysize": pkgutil.CalculateSizeInMB(constants.DefaultMemorySize)})
}

var cpuCount int
if viper.GetString(vmDriver) == constants.DriverNone {
ci, err := cpu.Info()
// Uses the gopsutil cpu package to count the number of physical cpu cores
ci, err := cpu.Counts(false)
if err != nil {
glog.Warningf("Unable to get CPU info: $v", err)
glog.Warningf("Unable to get CPU info: %v", err)
} else {
cpuCount = ci.Cores
cpuCount = ci
}
} else {
cpuCount = viper.GetInt(cpus)
Expand Down

0 comments on commit 6cde7c1

Please sign in to comment.