Files
Reims-Go/internal/host/memory.go
T
NwflowerandClaude Opus 5.5 3f8cf11d3d feat: offline install flow, installer page, commit-memory checks (v0.2)
- New VMs default to an offline installer of one exact release
  (`reims-ctl create --macos <ver> --offline --network false`); the wizard
  lists Apple's releases, marks downloaded ones and warns when space is short.
- Offline VMs get an install guide with the install-macos.sh command and a
  "Finish install" action that ejects the installer and turns the network on
  (FinishInstall; pending until the next start on a running VM).
- Installers page (roadmap M2.2): downloaded installers with resume/delete,
  Apple's releases with download, progress and pause, space check first.
- Commit memory: the host report carries Windows' commit limit and available
  commit; create/settings refuse memory over the limit, start refuses memory
  that can't be committed now with a clear message, and the wizard, settings
  and first launch show a recommended size (16G failed with 14.7 GiB free).
- First launch shows a host check (WHPX with enable, Vulkan GPU, memory)
  before the runtime install.
- Create validation rejects a VM name that already exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 05:09:50 -07:00

28 lines
811 B
Go

package host
// StartMarginGB is the commit memory a VM needs beyond its guest RAM: QEMU's own
// allocations and the graphics path. Conservative; refine with measurements.
const StartMarginGB = 1.0
// memoryChoices are the sizes the UI offers (GB).
var memoryChoices = []float64{4, 6, 8, 12, 16, 24, 32, 48, 64}
// RecommendedMemoryGB is the largest offered size that fits both in 60% of
// physical RAM and in the commit memory free now (minus StartMarginGB and 2 GB
// headroom for the host). At least 4.
func RecommendedMemoryGB(rep Report) float64 {
limit := rep.TotalRAMGB * 0.6
if rep.CommitAvailGB > 0 {
if c := rep.CommitAvailGB - StartMarginGB - 2; c < limit {
limit = c
}
}
best := memoryChoices[0]
for _, m := range memoryChoices {
if m <= limit {
best = m
}
}
return best
}