fix #7224: ui: utils: show memory usage above 100% correctly

render_mem_usage_percent() treated any value above 1 as a byte count
and recalculated the percentage from 'mem' and 'maxmem'. But the memory
usage ratio of a guest can legitimately exceed 1, for example when the
reported usage is the host-side memory of the QEMU process, which
includes its own overhead. In the reported case, 'mem' was 2222472192
with a 'maxmem' of 2147483648, so the ratio of about 1.035 got taken as
bytes and the search and resource grids showed 0.0 % instead of 103.5 %.

All users of the renderer now pass the usage as a ratio, so drop the
bytes fallback and always render the value as percentage.

Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
dualfroz committed 2026-09-25 07:15:08 +02:00
1 parent 8cb3c7079c
commit 0e587291d6
1 file changed
-10
-10
View File
@@ -1207,16 +1207,6 @@ Ext.define('PVE.Utils', {
if (!Ext.isNumeric(value) || value === -1) {
return '';
}
if (value > 1) {
// we got no percentage but bytes
let mem = value;
let maxmem = record.data.maxmem;
if (!record.data.uptime || maxmem === 0 || !Ext.isNumeric(mem)) {
return '';
}
return ((mem * 100) / maxmem).toFixed(1) + ' %';
}
return (value * 100).toFixed(1) + ' %';
},