Fix VMs without guest stats showing 0 MB usage
Don't fall back to allocated RAM for memory_total_mb when there's no guest-side data. Keeps both used and total at 0 so the frontend shows just the allocated amount instead of "0 MB / 16.0 GB". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
app.py
2
app.py
@@ -356,7 +356,7 @@ def get_vms():
|
|||||||
cpu_pct = round(max(0, min(100, cpu_pct)), 1)
|
cpu_pct = round(max(0, min(100, cpu_pct)), 1)
|
||||||
vm["cpu_percent"] = cpu_pct
|
vm["cpu_percent"] = cpu_pct
|
||||||
vm["memory_used_mb"] = stats["memory_used_mb"]
|
vm["memory_used_mb"] = stats["memory_used_mb"]
|
||||||
vm["memory_total_mb"] = stats["memory_total_mb"] or vm["memory_mb"]
|
vm["memory_total_mb"] = stats["memory_total_mb"]
|
||||||
else:
|
else:
|
||||||
vm["cpu_percent"] = 0.0
|
vm["cpu_percent"] = 0.0
|
||||||
vm["memory_used_mb"] = 0
|
vm["memory_used_mb"] = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user