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
This commit is contained in:
Pulse Monitor
2025-08-18 07:46:35 +00:00
parent 7f10296e3c
commit fc1bd556b6
+10
View File
@@ -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{