Files
Reims-Go/memcheck.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

38 lines
1005 B
Go

package main
import (
"fmt"
"github.com/Nwflower/reims-go/internal/driver/reims"
"github.com/Nwflower/reims-go/internal/host"
"github.com/Nwflower/reims-go/internal/i18n"
)
// checkStartMemory refuses to start a VM whose guest RAM can't be committed
// right now. Without it QEMU exits with "Cannot set up guest memory 'ram'"
// (measured 2026-11-28, portable-runtime-spec.md §5.1), which says nothing
// about what to do.
func (a *App) checkStartMemory(c *reims.Client, name string) error {
avail, ok := host.CommitAvailGB()
if !ok {
return nil
}
d, err := a.GetVMDetail(name)
if err != nil {
return nil // can't tell; let reims-ctl report its own error
}
memGB, ok := reims.ParseSizeGB(d.Memory)
if !ok {
return nil
}
if memGB+host.StartMarginGB <= avail {
return nil
}
a.mu.Lock()
loc := a.cfg.Locale
root := a.cfg.DataRoot
a.mu.Unlock()
rec := host.RecommendedMemoryGB(host.Inspect(root))
return fmt.Errorf("%s", i18n.T(loc, "err.commit_memory", memGB, avail, rec))
}