Skip to content

Number of CPUs is not validated #3987

@jandubois

Description

@jandubois

Setting to 0 is valid because it is the "null" value, meaning to use the default setting.

I wonder if the --cpus flag should not print a message in that case.

Setting to negative numbers is not caught by validation, but will cause a failure to start the VM. This must be caught; limactl edit should never leave lima.yaml in a non-startable state.

We do have validation to reject string values, even though allowing max or host would maybe make sense (host being the number of CPUs of the host, and max maybe 2 less?).

l edit -y foo --cpus 1
INFO[0000] Instance "foo" configuration editedl edit -y foo --cpus 0
INFO[0000] Instance "foo" configuration editedl edit -y foo --cpus -1
INFO[0000] Instance "foo" configuration editedl edit -y foo --cpus max
FATA[0000] invalid argument "max" for "--cpus" flag: strconv.ParseInt: parsing "max": invalid syntax

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions