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
This commit is contained in:
rcourtman
2026-01-10 15:37:45 +00:00
parent 1816e2dbb8
commit 1f4f0472b0
2 changed files with 13 additions and 9 deletions
+7 -5
View File
@@ -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 {
+6 -4
View File
@@ -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 {