Add condition to check --cpus count with available cpu count

pull/10388/head
BLasan 2021-02-07 01:08:08 +05:30
parent bdd1e6de6a
commit cc2bf6aa15
1 changed files with 5 additions and 1 deletions
cmd/minikube/cmd

View File

@ -995,7 +995,7 @@ func validateRequestedMemorySize(req int, drvName string) {
}
}
// validateCPUCount validates the cpu count matches the minimum recommended
// validateCPUCount validates the cpu count matches the minimum recommended & not exceeding the available cpu count
func validateCPUCount(drvName string) {
var cpuCount int
if driver.BareMetal(drvName) {
@ -1029,6 +1029,10 @@ func validateCPUCount(drvName string) {
}
if si.CPUs < cpuCount {
exitIfNotForced(reason.RsrcInsufficientCores, "Requested cpu count {{.requested_cpus}} is greater than the available cpus of {{.avail_cpus}}", out.V{"requested_cpus": cpuCount, "avail_cpus": si.CPUs})
}
// looks good
if si.CPUs >= 2 {
return