From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 019841FF0AF for ; Thu, 08 Oct 2026 11:51:12 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C5F842131E; Thu, 08 Oct 2026 11:51:11 +0200 (CEST) Message-ID: <4eb464b3-120a-4099-bb89-29710d741cb2@proxmox.com> Date: Thu, 8 Oct 2026 11:51:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH datacenter-manager v6 10/11] ui: pve: node selector: sort memory columns by usage not by memory size To: Dominik Csapak , pdm-devel@lists.proxmox.com References: <20261005110049.1851404-1-d.csapak@proxmox.com> <20261005110049.1851404-11-d.csapak@proxmox.com> Content-Language: en-US, de-DE From: Thomas Lamprecht In-Reply-To: <20261005110049.1851404-11-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791453068542 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.618 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: GCNURDWIEXIHA6GHHT74YRNYCAMUSMII X-Message-ID-Hash: GCNURDWIEXIHA6GHHT74YRNYCAMUSMII X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 05/10/2026 13:01, Dominik Csapak wrote: > We only show the usage, so it makes sense to sort by that instead of the > raw memory size value. > > Use total_cmp for floats, which sorts (+/-)NaN/Infinity separate from > finite values. btw. and rather orthogonal to this, but it might be also nice to check the some constraints here, like for example when using the selector for selecting a CT/VM migration target, checking if the available memory on the target is big enough to hold the to-be-moved guest. If not, or resulting headroom is rather small we could show a hint, as there are lot usage values where one cannot determine if the available memory amount will be a hard blocker, especially if the guest is currently is not running and one cannot determine its usage (plus KSM and other settings (one node using zram or so while the other not). Maybe with a bit of headroom for the node like say 0.5 to 1 GiB or so extra, absolute value as percents make not much sense in memory headroom in practice, as its there to be used and 2% of a 16 GiB system is basically always too small while 2% of a TiB system is rather big with no relation for why a bigger systems needs a proportional amount of more absolute head room (potentially with upper and lower boundary), IMO; but I digress into details. Also something I'd like to see in PVE in general. > Signed-off-by: Dominik Csapak > --- > ui/src/widget/pve_node_selector.rs | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/ui/src/widget/pve_node_selector.rs b/ui/src/widget/pve_node_selector.rs > index d471780e..5882f532 100644 > --- a/ui/src/widget/pve_node_selector.rs > +++ b/ui/src/widget/pve_node_selector.rs > @@ -261,7 +261,11 @@ fn columns(show_memory: bool) -> Rc>> { > } > html! {format!("{:.2}%", 100.0 * entry.mem as f64 / entry.maxmem as f64)} > }) > - .sorter(|a: &PveNodeResource, b: &PveNodeResource| a.mem.cmp(&b.mem)) > + .sorter(|a: &PveNodeResource, b: &PveNodeResource| { > + let a = (a.mem as f64) / (a.maxmem as f64); > + let b = (b.mem as f64) / (b.maxmem as f64); > + a.total_cmp(&b) > + }) > .into(), > ); > }