Stabilize diagnostics test VM selection

This commit is contained in:
rcourtman 2025-10-22 19:48:56 +00:00
parent dd2beffc8c
commit cdba742884

View file

@ -1135,7 +1135,8 @@ func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Clie
var testVM *proxmox.VM var testVM *proxmox.VM
var testVMNode string var testVMNode string
result.ProblematicVMs = []VMDiskIssue{} result.ProblematicVMs = []VMDiskIssue{}
for _, vm := range vms { for i := range vms {
vm := vms[i]
if vm.Template == 0 && vm.Status == "running" { if vm.Template == 0 && vm.Status == "running" {
vmNode := strings.TrimSpace(vm.Node) vmNode := strings.TrimSpace(vm.Node)
if vmNode == "" { if vmNode == "" {
@ -1169,7 +1170,7 @@ func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Clie
Issue: "Agent enabled but failed to get filesystem info: " + err.Error(), Issue: "Agent enabled but failed to get filesystem info: " + err.Error(),
}) })
if testVM == nil { if testVM == nil {
testVM = &vm testVM = &vms[i]
testVMNode = vmNode testVMNode = vmNode
} }
} else if len(fsInfo) == 0 { } else if len(fsInfo) == 0 {
@ -1180,7 +1181,7 @@ func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Clie
Issue: "Agent returned no filesystem info", Issue: "Agent returned no filesystem info",
}) })
if testVM == nil { if testVM == nil {
testVM = &vm testVM = &vms[i]
testVMNode = vmNode testVMNode = vmNode
} }
} else { } else {
@ -1209,7 +1210,7 @@ func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Clie
} }
if testVM == nil { if testVM == nil {
testVM = &vm testVM = &vms[i]
testVMNode = vmNode testVMNode = vmNode
} }
} }