diff --git a/pkg/limayaml/validate.go b/pkg/limayaml/validate.go index d0a76ff1250..96232f0e825 100644 --- a/pkg/limayaml/validate.go +++ b/pkg/limayaml/validate.go @@ -108,6 +108,10 @@ func Validate(y LimaYAML, warn bool) error { return errors.New("field `cpus` must be set") } + if *y.CPUs > runtime.NumCPU() { + return fmt.Errorf("field `cpus` is set to %d, which is greater than the number of CPUs available (%d)", *y.CPUs, runtime.NumCPU()) + } + if _, err := units.RAMInBytes(*y.Memory); err != nil { return fmt.Errorf("field `memory` has an invalid value: %w", err) }