From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id F04221FF144 for ; Tue, 10 Mar 2026 11:41:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0629A183EC; Tue, 10 Mar 2026 11:41:30 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Mar 2026 11:41:26 +0100 Message-Id: Subject: Re: [RFC proxmox 2/5] resource-scheduling: introduce generic cluster usage implementation From: "Daniel Kral" To: "Dominik Rusovac" , X-Mailer: aerc 0.21.0-38-g7088c3642f2c-dirty References: <20260217141437.584852-1-d.kral@proxmox.com> <20260217141437.584852-3-d.kral@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773139253447 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.034 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: PIYYB5NXXNTIH3CDZLDGAPNKZR37KBI2 X-Message-ID-Hash: PIYYB5NXXNTIH3CDZLDGAPNKZR37KBI2 X-MailFrom: d.kral@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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon Mar 9, 2026 at 2:38 PM CET, Dominik Rusovac wrote: > On Tue Feb 17, 2026 at 3:13 PM CET, Daniel Kral wrote: >> Declare generic NodeStats and ServiceStats structs, which special use >> cases convert their types into, and use these to implement generic >> scheduler methods such as the existing scoring of nodes to start a >> previously non-running service. >> >> This is best viewed with the git option --ignore-all-space. >> >> Signed-off-by: Daniel Kral >> --- > > [snip] > >> /// Scores candidate `nodes` to start a `service` on. Scoring is done a= ccording to the static memory >> /// and CPU usages of the nodes as if the service would already be runn= ing on each. >> /// >> /// Returns a vector of (nodename, score) pairs. Scores are between 0.0= and 1.0 and a higher score >> /// is better. >> +#[deprecated] > > It would be nice to provide a deprecation message, which mentions at > least the preferred alternative function, via > > #[deprecated =3D "use ... instead"] > Will do so to make the deprecation clearer! >> pub fn score_nodes_to_start_service>( >> nodes: &[T], >> service: &StaticServiceUsage, >> ) -> Result, Error> { >> - scheduler::score_nodes_to_start_service(nodes, service) >> + let nodes =3D nodes >> + .iter() >> + .map(|node| node.as_ref().clone().into()) >> + .collect::>(); >> + >> + let cluster_usage =3D ClusterUsage::from_nodes(nodes); >> + >> + cluster_usage.score_nodes_to_start_service(*service) >> }