Skip to content

restart: accept editflags to modify configuration before restarting#5076

Open
itsme-ranger wants to merge 1 commit into
lima-vm:masterfrom
itsme-ranger:feat/restart-editflags
Open

restart: accept editflags to modify configuration before restarting#5076
itsme-ranger wants to merge 1 commit into
lima-vm:masterfrom
itsme-ranger:feat/restart-editflags

Conversation

@itsme-ranger
Copy link
Copy Markdown

Fixes #4249

Changes

limactl restart now accepts all editflags (the same flags available on limactl edit), so you can atomically edit and restart an instance in one command:

# Change memory to 8 GiB and restart
limactl restart --memory=8 myinstance

# Change CPUs and restart forcibly
limactl restart --force --cpus=4 myinstance

# Use raw yq expression and restart
limactl restart --set '.ssh.localPort = 60023' myinstance

Implementation

When any editflag is provided, restartAction reads the current lima.yaml, applies the yq expressions, validates the result (same pipeline as limactl edit), and writes the updated config — all before stopping the instance. This ensures validation errors are caught before any disruptive stop. Then the normal stop+start flow runs via instance.Restart / instance.RestartForcibly.

If no editflags are provided, behavior is identical to before.

Testing

  • go build ./cmd/limactl/ passes
  • go test ./cmd/limactl/... passes
  • golangci-lint run ./cmd/limactl/... reports 0 issues

Closes lima-vm#4249

Signed-off-by: Ramadhan Gerry Akbar <ramadhan.gerry@gmail.com>
@itsme-ranger itsme-ranger force-pushed the feat/restart-editflags branch from 800ae74 to 99a2b61 Compare June 3, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

limactl restart should accept options that changes the VM settings like --set

1 participant