From 0ad5652ecd7eeacf02f267bcd3deb53829c11f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E5=B7=9D=E7=99=BD=E6=B5=AA?= <1679659@qq.com> Date: Sun, 29 Nov 2026 00:34:57 -0700 Subject: [PATCH] fix(settings): read VMware SVGA and an unlimited stop timeout back reims-ctl 3731afd prints "VMware SVGA, no GPU acceleration, ..." for the graphics and "none: stop waits until the guest shuts down" for a stop timeout of 0 (crates/reims-ctl/src/cli.rs, describe). The settings page read those VMs as reims-vgpu with a 90 s timeout. The audio backend picker also shows a backend set elsewhere, such as wav, instead of leaving every option unselected. Co-Authored-By: Claude Opus 5.5 --- frontend/src/components/SettingsModal.tsx | 2 ++ internal/driver/reims/reims.go | 7 ++++- internal/driver/reims/reims_test.go | 35 +++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/SettingsModal.tsx b/frontend/src/components/SettingsModal.tsx index 2bcabdc..fd1da45 100644 --- a/frontend/src/components/SettingsModal.tsx +++ b/frontend/src/components/SettingsModal.tsx @@ -767,6 +767,8 @@ export const SettingsModal: React.FC = ({ locale, detail, stats, host, op { value: 'auto', label: tr('audioBackendAuto') }, { value: 'dsound', label: tr('audioBackendDsound') }, { value: 'none', label: tr('audioBackendNone') }, + // A backend set elsewhere (`reims-ctl set --audio-backend wav`) still shows as chosen. + ...(['auto', 'dsound', 'none'].includes(form.audio_backend || 'auto') ? [] : [{ value: form.audio_backend as string, label: form.audio_backend as string }]), ]} /> } diff --git a/internal/driver/reims/reims.go b/internal/driver/reims/reims.go index 7940540..7608e8a 100644 --- a/internal/driver/reims/reims.go +++ b/internal/driver/reims/reims.go @@ -571,7 +571,9 @@ func ParseShow(name, text string) VMDetail { d.DiskController = "ahci" } case "graphics": - if strings.HasPrefix(v, "vmware-svga") { + // "VMware SVGA, no GPU acceleration, in QEMU's window" (3731afd + // cli.rs describe); older builds printed "vmware-svga". + if low := strings.ToLower(v); strings.HasPrefix(low, "vmware svga") || strings.HasPrefix(low, "vmware-svga") { d.Graphics = "vmware-svga" } else { d.Graphics = "reims-vgpu" @@ -628,8 +630,11 @@ func ParseShow(name, text string) VMDetail { d.LogLevel = m[1] } case "stop timeout": + // "90 s", or "none: stop waits until the guest shuts down" for 0. if m := regexp.MustCompile(`(\d+)`).FindString(v); m != "" { d.StopTimeout, _ = strconv.Atoi(m) + } else if strings.HasPrefix(strings.ToLower(v), "none") { + d.StopTimeout = 0 } case "capture": low := strings.ToLower(strings.TrimSpace(v)) diff --git a/internal/driver/reims/reims_test.go b/internal/driver/reims/reims_test.go index d061c38..c15833d 100644 --- a/internal/driver/reims/reims_test.go +++ b/internal/driver/reims/reims_test.go @@ -138,3 +138,38 @@ func TestParseShowDisplayCount(t *testing.T) { } } } + +// Lines as reims-ctl 3731afd's describe (crates/reims-ctl/src/cli.rs) prints +// non-default settings. +func TestParseShowNonDefaultLines(t *testing.T) { + text := "m0\n" + + " state stopped\n" + + " disk disk.qcow2 (qcow2, SATA)\n" + + " graphics VMware SVGA, no GPU acceleration, in QEMU's window\n" + + " audio none\n" + + " network user, mac 52:54:00:12:34:56\n" + + " logs on (trace)\n" + + " stop timeout none: stop waits until the guest shuts down\n" + d := ParseShow("m0", text) + if d.Graphics != "vmware-svga" { + t.Errorf("graphics = %q, want vmware-svga", d.Graphics) + } + if d.StopTimeout != 0 { + t.Errorf("stop timeout = %d, want 0 (no limit)", d.StopTimeout) + } + if d.DiskController != "ahci" { + t.Errorf("disk controller = %q, want ahci", d.DiskController) + } + if !d.Audio || d.AudioBackend != "none" { + t.Errorf("audio = %v/%q, want on with backend none", d.Audio, d.AudioBackend) + } + if !d.Network || d.SSHPort != 0 { + t.Errorf("network = %v ssh %d, want on with no ssh port", d.Network, d.SSHPort) + } + if !d.Logs || d.LogLevel != "trace" { + t.Errorf("logs = %v/%q, want on (trace)", d.Logs, d.LogLevel) + } + if d := ParseShow("m0", "m0\n graphics reims-vgpu, its own GPU device and macOS drivers\n stop timeout 30 s\n"); d.Graphics != "reims-vgpu" || d.StopTimeout != 30 { + t.Errorf("reims-vgpu / 30 s parsed as %q / %d", d.Graphics, d.StopTimeout) + } +}