From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 1/2] fix #6874: ui: node selectors: sort memory usage by percentage
Date: Fri, 25 Sep 2026 05:32:13 +0000 [thread overview]
Message-ID: <20260925053214.7-2-me@dualfroz.com> (raw)
In-Reply-To: <20260925053214.7-1-me@dualfroz.com>
The memory usage column of the node selector, used e.g. in the
migration dialog, and of the HA node priority selector shows a
percentage, but uses the raw 'mem' bytes as data index. Sorting by that
column thus sorts by used bytes, which does not match the displayed
values as soon as the nodes have a different amount of memory.
Add a calculated 'memuse' field, like the resource store already has,
and use it for the column. This also makes the percentage renderer
receive a ratio here, like everywhere else, which allows dropping its
bytes fallback in a follow-up.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
www/manager6/form/NodeSelector.js | 16 ++++++++++++++--
www/manager6/ha/NodePrioritySelector.js | 14 ++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/www/manager6/form/NodeSelector.js b/www/manager6/form/NodeSelector.js
index 37d3ee5b..73d173bb 100644
--- a/www/manager6/form/NodeSelector.js
+++ b/www/manager6/form/NodeSelector.js
@@ -16,7 +16,19 @@ Ext.define('PVE.form.NodeSelector', {
valueField: 'node',
displayField: 'node',
store: {
- fields: ['node', 'cpu', 'maxcpu', 'mem', 'maxmem', 'uptime'],
+ fields: [
+ 'node',
+ 'cpu',
+ 'maxcpu',
+ 'mem',
+ 'maxmem',
+ 'uptime',
+ {
+ name: 'memuse',
+ type: 'number',
+ calculate: PVE.Utils.calculate_mem_usage,
+ },
+ ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes',
@@ -47,7 +59,7 @@ Ext.define('PVE.form.NodeSelector', {
renderer: PVE.Utils.render_mem_usage_percent,
sortable: true,
width: 100,
- dataIndex: 'mem',
+ dataIndex: 'memuse',
},
{
header: gettext('CPU usage'),
diff --git a/www/manager6/ha/NodePrioritySelector.js b/www/manager6/ha/NodePrioritySelector.js
index 635374fd..9e26b2e0 100644
--- a/www/manager6/ha/NodePrioritySelector.js
+++ b/www/manager6/ha/NodePrioritySelector.js
@@ -23,7 +23,17 @@ Ext.define('PVE.forms.NodePrioritySelector', {
store: {
autoLoad: true,
- fields: ['node', 'cpu', 'mem', 'priority'],
+ fields: [
+ 'node',
+ 'cpu',
+ 'mem',
+ 'priority',
+ {
+ name: 'memuse',
+ type: 'number',
+ calculate: PVE.Utils.calculate_mem_usage,
+ },
+ ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes',
@@ -47,7 +57,7 @@ Ext.define('PVE.forms.NodePrioritySelector', {
renderer: PVE.Utils.render_mem_usage_percent,
sortable: true,
width: 150,
- dataIndex: 'mem',
+ dataIndex: 'memuse',
},
{
header: gettext('CPU usage'),
--
2.43.0
next prev parent reply other threads:[~2026-09-28 7:15 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 ` Michal Fox [this message]
2026-09-25 5:32 ` [PATCH manager 2/2] fix #7224: ui: utils: show memory usage above 100% correctly Michal Fox
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-2-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