mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
Size.Check refused only memory above the host's total, so --memory 8 on an 8 GiB host passed, though a VM asking for all of the host's memory doesn't start. It now refuses more than backend.MaxMemory allows, the limit of the rule base's memory is fitted by: the host's whole GiB less 2, or half of them on a host of 4 GiB or less. Whatever FitMemory gives always passes. CPUs stay limited to the host's count. Check runs for a new VM, devvm size and devvm size -g only: a VM whose recorded size is over the limit still starts. Changes: - internal/backend/fit.go: MaxMemory(hostBytes uint64) float64 beside FitMemory, with TestMaxMemory (which also checks FitMemory never exceeds it). - internal/vm/size.go: Check uses MaxMemory (Host.memoryBytes converts the whole GiB); too_much_memory gets max, the largest --memory that works (fields have, max, want). - locales/en.toml, messages_gen.go: too_much_memory's text and description. - Tests: TestSizeCheck's cases updated (32 GiB host: max 30), and new ones: 8 GiB refuses 8 and 7, allows 6; 4 GiB allows 2, refuses 3; 3 GiB allows 1.5. up_size.txtar expects max. - Docs: using/ports-size.md says the most memory a VM can have, for new VMs, devvm size and devvm size -g, what devvm says when it's too much, and that VMs already over it still start; internals/images.md's Base's size section says the check shares the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>