Repository navigation
Conversation
Signed-off-by: somaz <genius5711@gmail.com>
…merged in OSS contributions
|
I checked this PR against Environment
TestsThe new test does not compile on
Output of the failing run: On the head, Notes from reading the codeI did not test these points.
Not tested
|
Signed-off-by: somaz <genius5711@gmail.com>
|
Thanks for testing and catching the |
Refs #1561
Problem
With
COLIMA_SAVE_CONFIG=0and a partial, read-only colima.yaml (the Nix setup in #1561),colima startworks butcolima restartstops the VM and then fails, leaving it stopped. With this file:restart ends with:
Cause
colima startrunsprepareConfigfirst, which fills in the flag defaults, the template and the fixed settings.colima restartpassed the file toapp.Startexactly as it was read. With the defaultCOLIMA_SAVE_CONFIG=1that file is the full config saved by the last start, so nothing is missing. With a partial file, restart starts withrootDisk: 0, so Lima tries to shrink the root disk, and withbinfmtunset, which skips the binfmt setup.Fix
restart now prepares the config with the same
prepareConfigas start and validates it before stopping the VM, so a config that fails validation no longer leaves the VM stopped. It still never writes the config file. When the file is missing or has noruntime, prepareConfig would ignore it and use plain defaults, which can grow the data disk (for example afterCOLIMA_SAVE_CONFIG=0 colima start --disk 60), so restart uses the config the instance last started with instead. An unreadable file is still an error, as before.Testing
Test_restartConfigcovers a partial file, a missing file and an unreadable file, and the first two fail on main.go test ./...passes on macOS and in agolang:1.26.1Linux container, and golangci-lint v2.11.3 reports no issues for darwin and linux. I also reproduced the issue on macOS 14 (Apple Silicon, vz, containerd) with the file above: restart fails on main as shown and works with this change whether the VM is running or stopped. With the file moved away, it restarts with the instance's last config and the data disk stays at 20GiB.The
networks.yamlandcolima listsymptoms in #1561 are not covered here.AI disclosure: all of the code and tests in this PR were written with Claude Code (Claude Opus 5.5), and the checks above were run through it. I reviewed the whole diff before opening this PR.