public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 2/2] fix #7224: ui: utils: show memory usage above 100% correctly
Date: Fri, 25 Sep 2026 05:32:14 +0000	[thread overview]
Message-ID: <20260925053214.7-3-me@dualfroz.com> (raw)
In-Reply-To: <20260925053214.7-1-me@dualfroz.com>

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>
---
 www/manager6/Utils.js | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8b99371d..91dfd6ee 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -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) + ' %';
         },
 
-- 
2.43.0




      parent reply	other threads:[~2026-09-28  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  5:32 [PATCH manager 0/2] ui: fix memory usage percentage above 100% and its sorting Michal Fox
2026-09-25  5:32 ` [PATCH manager 1/2] fix #6874: ui: node selectors: sort memory usage by percentage Michal Fox
2026-09-25  5:32 ` Michal Fox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925053214.7-3-me@dualfroz.com \
    --to=me@dualfroz.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal