From 1f4f0472b096cfbf2df22e6764dc1f4d6d3c26d4 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 10 Jan 2026 15:37:45 +0000 Subject: [PATCH] fix: use configured memory (MaxMem) instead of balloon for VM total Previously, when memory ballooning was active on a VM, Pulse would use the balloon value as the total memory instead of the configured MaxMem. This caused confusing displays where a 4GB VM with 1GB balloon would show "94% (966MB/1GB)" instead of "24% (966MB/4GB)". The balloon value is still tracked in memory.balloon for the frontend's yellow balloon marker visualization, but no longer replaces the total. Fixes #1070 --- internal/monitoring/monitor.go | 12 +++++++----- internal/monitoring/monitor_polling.go | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index a0edf1849..a33e16b03 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -6282,12 +6282,14 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNam networkInBytes = int64(detailedStatus.NetIn) networkOutBytes = int64(detailedStatus.NetOut) - if detailedStatus.Balloon > 0 && detailedStatus.Balloon < detailedStatus.MaxMem { - memTotal = detailedStatus.Balloon - guestRaw.DerivedFromBall = true - } else if detailedStatus.MaxMem > 0 { + // Note: We intentionally do NOT override memTotal with balloon. + // The balloon value is tracked separately in memory.balloon for + // visualization purposes. Using balloon as total causes user + // confusion (showing 1GB/1GB at 100% when VM is configured for 4GB) + // and makes the frontend's balloon marker logic ineffective. + // Refs: #1070 + if detailedStatus.MaxMem > 0 { memTotal = detailedStatus.MaxMem - guestRaw.DerivedFromBall = false } switch { diff --git a/internal/monitoring/monitor_polling.go b/internal/monitoring/monitor_polling.go index 7ffb8a1cc..d2ef9b3c0 100644 --- a/internal/monitoring/monitor_polling.go +++ b/internal/monitoring/monitor_polling.go @@ -352,10 +352,12 @@ func (m *Monitor) pollVMsWithNodes(ctx context.Context, instanceName string, clu } } } - if vmStatus.Balloon > 0 && vmStatus.Balloon < vmStatus.MaxMem { - memTotal = vmStatus.Balloon - guestRaw.DerivedFromBall = true - } + // Note: We intentionally do NOT override memTotal with balloon. + // The balloon value is tracked separately in memory.balloon for + // visualization purposes. Using balloon as total causes user + // confusion (showing 1GB/1GB at 100% when VM is configured for 4GB) + // and makes the frontend's balloon marker logic ineffective. + // Refs: #1070 switch { case memAvailable > 0: if memAvailable > memTotal {