lima icon indicating copy to clipboard operation
lima copied to clipboard

Override parameters in template file from cli

Open Jasstkn opened this issue 2 years ago • 4 comments

Description

Hi. I wonder if it's possible to override template parameters via limactl? For example:

limactl start --name=default --template=default.yml --cpus=1 --memory=2GiB

If it's not very difficult I can contribute with some guidance.

can be related to https://github.com/lima-vm/lima/issues/545

Jasstkn avatar Apr 04 '22 08:04 Jasstkn

--cpus=1 --memory=2GiB

I'd prefer this to support JSON paths like --set .cpus=1 --set .memory=2GiB

AkihiroSuda avatar Apr 04 '22 11:04 AkihiroSuda

This has been discussed multiple times before. One still unresolved challenge is where to store the manual overrides. Editing/merging this into the user-provided lima.yaml is difficult if you want to preserve existing comments etc.

I guess we could store them in a separate file for per-instance overrides...

Another thing to consider: I believe you should be able to change settings this was as well, so this should work:

limactl start --name=default template://default --set .cpus=1 --set .memory=8GiB
limactl stop
limactl start --set .cpus=6

And now the instance should be running with 6 CPUs and 8 GiB of memory.

jandubois avatar Apr 04 '22 16:04 jandubois

This has been discussed multiple times before. One still unresolved challenge is where to store the manual overrides. Editing/merging this into the user-provided lima.yaml is difficult if you want to preserve existing comments etc.

I guess we could store them in a separate file for per-instance overrides...

Another thing to consider: I believe you should be able to change settings this was as well, so this should work:

limactl start --name=default template://default --set .cpus=1 --set .memory=8GiB
limactl stop
limactl start --set .cpus=6

And now the instance should be running with 6 CPUs and 8 GiB of memory.

Agree, actually any solution is fine by me.

Jasstkn avatar Apr 06 '22 11:04 Jasstkn

I guess we could store them in a separate file for per-instance overrides...

SGTM

limactl start --set .cpus=6

I feel this should be limactl edit --set .cpus=6. The limactl start command should accept --set only for new instances.

AkihiroSuda avatar Apr 08 '22 07:04 AkihiroSuda