mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 02:25:56 +00:00
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:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user