From 1c51d03350801a9ccfbea4fc744445c2bd24201f Mon Sep 17 00:00:00 2001 From: kamaji Date: Tue, 24 Feb 2026 22:07:17 -0600 Subject: [PATCH] Fix misleading memory usage for VMs without guest-side stats Windows VMs only report balloon current/max/rss, not available/unused. Previously this fell through to RSS which showed ~100% usage. Now VMs without balloon.available show allocated RAM without a usage bar. Co-Authored-By: Claude Opus 4.6 --- app.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 5f1afcd..7683ef0 100644 --- a/app.py +++ b/app.py @@ -216,13 +216,12 @@ def get_vm_live_stats(): balloon_unused = s.get("balloon_unused", 0) balloon_rss = s.get("balloon_rss", 0) - if balloon_avail > 0: + if balloon_avail > 0 and balloon_unused >= 0: mem_total = balloon_avail // 1024 # KiB to MB mem_used = (balloon_avail - balloon_unused) // 1024 - elif balloon_rss > 0: - mem_total = 0 - mem_used = balloon_rss // 1024 else: + # No guest-side stats (e.g. Windows without full guest agent). + # Mark as unavailable — frontend will show allocated RAM only. mem_total = 0 mem_used = 0