Files
Reims-Go/internal/app/affinity_flow_test.go
T
NwflowerandClaude Opus 5.5 c0f08be124 feat: per-VM CPU affinity, disk snapshots, SSH helpers and VM window actions
Backend
- Per-VM CPU affinity (vmstart/affinity.go, affinity_flow.go): modes auto /
  all / P-cores / non-LP-E / custom, saved in the VM folder, applied to the
  QEMU process on start (GUI and CLI) and live via SetVMAffinity; copied on
  clone. Start summary logs the resolved mapping. Host report gains CPU
  topology helpers (mask <-> CPU list).
- Offline qcow2 restore points via qemu-img (driver/reims/snapshot.go,
  snapshot_flow.go): list / create / restore / delete.
- SSH helpers (ssh_flow.go): remembered user, open a terminal, write an
  ~/.ssh/config entry, open VS Code Remote-SSH.
- FocusVMWindow brings the QEMU window forward (restoring it if minimized);
  CopyVMScreenshot copies a full-resolution frame to the clipboard.
- DeliverPathsToGuest copies dropped host files into the shared folder;
  main.go enables Wails file drop on elements marked --wails-drop-target.
- VM note (.reims-go-note) and a storage breakdown (extras_flow.go).

Frontend
- VM page: running state's "Show Window" and the screen preview use
  FocusVMWindow; camera button and More-menu item copy a screenshot;
  editable note under the name; SSH row shows the saved user with
  Terminal / config / VS Code actions; restore-point list; install guide
  steps can be ticked off; drop files onto the page to send them.
- Sidebar right-click menu per VM (start, show window, screenshot, stop,
  restart, settings, folders, clone, delete); double-click and Ctrl+Enter
  still run the main action.
- AffinityDialog opened from the VM menu and VM settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 04:00:48 -07:00

47 lines
1.2 KiB
Go

package app
import (
"reflect"
"testing"
"github.com/Nwflower/reims-go/internal/driver/reims"
"github.com/Nwflower/reims-go/internal/host"
"github.com/Nwflower/reims-go/internal/vmstart"
)
func TestBuildVMAffinityStatus(t *testing.T) {
dir := t.TempDir()
eco := true
if _, err := vmstart.SaveVMAffinity(dir, vmstart.VMAffinityConfig{
Mode: vmstart.AffinityCustom,
CPUs: []int{0, 2, 4, 6},
DisableEcoQoS: &eco,
}, 16); err != nil {
t.Fatalf("SaveVMAffinity: %v", err)
}
rep := host.Report{LogicalCPUs: 16}
st := buildVMAffinityStatus(reims.VMDetail{
Name: "test-vm",
Directory: dir,
CPUs: 6,
State: "stopped",
}, rep, true, 0)
if st.Mode != "custom" || st.EffectiveMode != "custom" {
t.Fatalf("modes = (%s, %s), want custom", st.Mode, st.EffectiveMode)
}
if !reflect.DeepEqual(st.EffectiveCPUs, []int{0, 2, 4, 6}) {
t.Fatalf("EffectiveCPUs = %v", st.EffectiveCPUs)
}
if st.EffectiveMaskHex != "0x55" {
t.Fatalf("EffectiveMaskHex = %s, want 0x55", st.EffectiveMaskHex)
}
if !st.Oversubscribed {
t.Fatalf("expected Oversubscribed=true for 4 CPUs < 6 vCPUs")
}
if !st.DisableEcoQoS {
t.Fatalf("expected DisableEcoQoS=true")
}
}