Skip to content

Commit 71cb0f7

Browse files
committed
return error if user requestes cpus exceeds hardware cpus
Signed-off-by: notpranavunsw <[email protected]> ran linter Signed-off-by: notpranavunsw <[email protected]>
1 parent 377d685 commit 71cb0f7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/limayaml/validate.go

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func Validate(y LimaYAML, warn bool) error {
108108
return errors.New("field `cpus` must be set")
109109
}
110110

111+
if *y.CPUs > runtime.NumCPU() {
112+
return fmt.Errorf("field `cpus` is set to %d, which is greater than the number of CPUs available (%d)", *y.CPUs, runtime.NumCPU())
113+
}
114+
111115
if _, err := units.RAMInBytes(*y.Memory); err != nil {
112116
return fmt.Errorf("field `memory` has an invalid value: %w", err)
113117
}

0 commit comments

Comments
 (0)