From fc1bd556b6207768bd4e5c3c7620b33953eb7e56 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Mon, 18 Aug 2025 07:46:35 +0000 Subject: [PATCH] fix: add missing Type field when creating VMs/containers from cluster resources addresses #329 - VMs were being displayed as LXC containers because the Type field wasn't being set when using the efficient cluster/resources polling method --- internal/monitoring/monitor.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index 16f8c6ce8..5e7859778 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -884,6 +884,14 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNam for _, res := range resources { guestID := fmt.Sprintf("%s-%s-%d", instanceName, res.Node, res.VMID) + // Debug log the resource type + log.Debug(). + Str("instance", instanceName). + Str("name", res.Name). + Int("vmid", res.VMID). + Str("type", res.Type). + Msg("Processing cluster resource") + // Calculate I/O rates currentMetrics := IOMetrics{ DiskRead: int64(res.DiskRead), @@ -908,6 +916,7 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNam Node: res.Node, Instance: instanceName, Status: res.Status, + Type: "qemu", CPU: safeFloat(res.CPU), CPUs: res.MaxCPU, Memory: models.Memory{ @@ -954,6 +963,7 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNam Node: res.Node, Instance: instanceName, Status: res.Status, + Type: "lxc", CPU: safeFloat(res.CPU), CPUs: int(res.MaxCPU), Memory: models.Memory{