Files
Reims-Go/internal/host/host.go
T
NwflowerandClaude Opus 5.5 2f43182f0c feat: offline installer downloads, task progress events, Win10 cold reboot
Offline installers (roadmap M1.3):
- internal/installer drives `reims-util --json offline-installer` and parses
  its JSON event stream (upstream reims-vgpu 3731afd, reims_util.rs:423-509)
- downloads hold installers/.lock like reims-ctl, so the two never write the
  same file; checked against the real reims-ctl (TestLockExcludesReimsCtl)
- pause = stop the process, rerun resumes; deletes go through
  `reims-ctl downloads delete`, which refuses files in use or downloading
- CLI: reims-go installer list | download | cached | delete
- Wails bindings: ListOfflineReleases, DownloadInstaller, ListInstallers,
  DeleteInstaller

Task events (ui-redesign B1):
- tasks.go tracks long-running work and emits "reims:task" (throttled to
  200 ms per task); VM creation turns reims-ctl's progress lines into task
  progress and logs each step once
- the status bar shows the current task with a progress bar, details in a
  tooltip and a pause button; the frontend regex merging is removed

Win10 cold reboot workaround:
- host probes whether WinHvPlatform.dll lacks WHvResetPartition (Win10 19045)
- internal/qmp watches a dedicated QMP channel for guest resets; with
  -no-reboot the app restarts the VM in a fresh partition
- architecture.md documents download routing and the workaround

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

94 lines
2.8 KiB
Go

package host
import "strings"
type GPUKind string
const (
GPUDiscrete GPUKind = "discrete"
GPUIntegrated GPUKind = "integrated"
GPUVirtual GPUKind = "virtual"
GPUUnknown GPUKind = "unknown"
)
type GPUInfo struct {
Name string `json:"name"`
VulkanICD string `json:"vulkan_icd"`
Kind GPUKind `json:"kind"`
}
type WHPXState string
const (
WHPXReady WHPXState = "ready"
WHPXNoHypervisor WHPXState = "no_hypervisor"
WHPXMissing WHPXState = "missing"
WHPXUnsupported WHPXState = "unsupported"
)
type Report struct {
OS string `json:"os"`
Arch string `json:"arch"`
LogicalCPUs int `json:"logical_cpus"`
PhysicalCores int `json:"physical_cores"`
HasHybridCores bool `json:"has_hybrid_cores"`
PCoreCount int `json:"p_core_count"`
ECoreCount int `json:"e_core_count"`
PCoreMask uint64 `json:"p_core_mask"`
PCoreMaskHex string `json:"p_core_mask_hex"`
PCoreLogicalCPUs []int `json:"p_core_logical_cpus,omitempty"`
ECoreLogicalCPUs []int `json:"e_core_logical_cpus,omitempty"`
TotalRAMGB float64 `json:"total_ram_gb"`
AvailRAMGB float64 `json:"avail_ram_gb"`
DataRoot string `json:"data_root"`
FreeDiskGB float64 `json:"free_disk_gb"`
WHPX WHPXState `json:"whpx"`
NeedsColdRebootWorkaround bool `json:"needs_cold_reboot_workaround"`
GPUs []GPUInfo `json:"gpus"`
RecommendedGPU *GPUInfo `json:"recommended_gpu,omitempty"`
}
// ClassifyGPU distinguishes discrete, integrated, and virtual display adapters.
func ClassifyGPU(name string) GPUKind {
low := strings.ToLower(name)
for _, v := range []string{"todesk", "gameviewer", "parsec", "virtual", "idd", "microsoft basic", "spacedesk"} {
if strings.Contains(low, v) {
return GPUVirtual
}
}
for _, d := range []string{"nvidia", "geforce", "rtx", "gtx", "quadro", "radeon rx", "radeon pro", "intel(r) arc"} {
if strings.Contains(low, d) {
return GPUDiscrete
}
}
for _, i := range []string{"intel(r) uhd", "intel(r) hd", "intel(r) iris", "radeon(tm) graphics"} {
if strings.Contains(low, i) {
return GPUIntegrated
}
}
return GPUUnknown
}
// PickRecommendedGPU selects the best Vulkan GPU (preferring discrete over integrated, skipping virtual).
func PickRecommendedGPU(gpus []GPUInfo) *GPUInfo {
for i := range gpus {
if gpus[i].Kind == GPUDiscrete && gpus[i].VulkanICD != "" {
cp := gpus[i]
return &cp
}
}
for i := range gpus {
if gpus[i].Kind == GPUIntegrated && gpus[i].VulkanICD != "" {
cp := gpus[i]
return &cp
}
}
for i := range gpus {
if gpus[i].Kind != GPUVirtual && gpus[i].VulkanICD != "" {
cp := gpus[i]
return &cp
}
}
return nil
}