Skip to content

Commit

Permalink
Updated cpu check to handle none driver cpu check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKam committed Aug 22, 2019
1 parent fac785f commit 2d763cf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import (
"k8s.io/minikube/pkg/util/lock"
"k8s.io/minikube/pkg/util/retry"
"k8s.io/minikube/pkg/version"
"github.com/shirou/gopsutil/cpu"
)

const (
Expand Down Expand Up @@ -538,7 +539,16 @@ func validateConfig() {
out.V{"memory": memorySizeMB, "default_memorysize": pkgutil.CalculateSizeInMB(constants.DefaultMemorySize)})
}

cpuCount = viper.GetInt(cpus)
if viper.GetString(vmDriver) == constants.DriverNone {
ci, err := cpu.Info()
if err != nil {
glog.Warningf("Unable to get CPU info: $v", err)
} else {
cpuCount = ci.Cores
}
} else {
cpuCount = viper.GetInt(cpus)
}
if cpuCount < constants.MinimumCPUS {
exit.UsageT("Requested cpu count {{.requested_cpus}} is less than the minimum allowed of {{.minimum_cpus}}", out.V{"requested_cpus": cpuCount, "minimum_cpus": constants.MinimumCPUS})
}
Expand Down

0 comments on commit 2d763cf

Please sign in to comment.