public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Daniel Kral" <d.kral@proxmox.com>
To: "Thomas Lamprecht" <t.lamprecht@proxmox.com>,
	"Proxmox VE development discussion" <pve-devel@lists.proxmox.com>,
	"Daniel Kral" <d.kral@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox v3 1/1] resource-scheduling: change score_nodes_to_start_service signature
Date: Thu, 13 Nov 2025 09:58:41 +0100	[thread overview]
Message-ID: <DE7FYOAE3G46.1O7MN0LT1M03G@proxmox.com> (raw)
In-Reply-To: <3e981812-deeb-4909-a5d4-bf5a204ac051@proxmox.com>

On Wed Nov 12, 2025 at 12:01 PM CET, Thomas Lamprecht wrote:
> Am 27.10.25 um 17:46 schrieb Daniel Kral:
>> This is needed as StaticNodeUsage is created in each invocation of
>> PVE::RS::ResourceScheduling::Static::score_nodes_to_start_service now.
>> 
>> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
>> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
>> ---
>>  proxmox-resource-scheduling/src/pve_static.rs | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/proxmox-resource-scheduling/src/pve_static.rs b/proxmox-resource-scheduling/src/pve_static.rs
>> index d39614cd..fc40cb5c 100644
>> --- a/proxmox-resource-scheduling/src/pve_static.rs
>> +++ b/proxmox-resource-scheduling/src/pve_static.rs
>> @@ -70,7 +70,7 @@ criteria_struct! {
>>  /// Returns a vector of (nodename, score) pairs. Scores are between 0.0 and 1.0 and a higher score
>>  /// is better.
>>  pub fn score_nodes_to_start_service(
>> -    nodes: &[&StaticNodeUsage],
>> +    nodes: &[StaticNodeUsage],
>
> Or keep it backward compatible using generics and an AsRef bound:
>
> pub fn score_nodes_to_start_service<T: AsRef<StaticNodeUsage>>(
>     nodes: &[T],
> ) {
>
> Not something I'd heavily promote do always do, but for one such changes are
> not required very often in the first place, and being able to bump and roll
> out this while still allowing to build and bump pve-rs without your changes
> there has its small benefits.
> That said, generics will result in multiple copies of the function (one per
> actual type used), but that is mostly a problem for bigger methods, albeit
> there one often can move the actual impl to a dedicated private fn and let
> the public fn just handle "resolving" the generics and calling into the
> actual impl). Here we will just use a single type anyway, just switching that
> from a ref to a value, so the generic has no real practical cost for us and
> thus would be worthwhile.

I should use Git Notes more often again, I had a small comment about
this in the original patch series contemplating this ;)

Will go for that approach to minimize the cost of versioned breaks!

>
>>      service: &StaticServiceUsage,
>>  ) -> Result<Vec<(String, f64)>, Error> {
>>      let len = nodes.len();



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-11-13  8:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 16:43 [pve-devel] [PATCH ha-manager/perl-rs/proxmox v3 00/11] Granular online_node_usage accounting Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH proxmox v3 1/1] resource-scheduling: change score_nodes_to_start_service signature Daniel Kral
2025-11-12 11:01   ` Thomas Lamprecht
2025-11-13  8:58     ` Daniel Kral [this message]
2025-10-27 16:43 ` [pve-devel] [PATCH perl-rs v3 1/2] pve-rs: resource_scheduling: allow granular usage changes Daniel Kral
2025-11-12 10:49   ` Thomas Lamprecht
2025-11-13  9:30     ` Daniel Kral
2025-11-14 10:12       ` Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH perl-rs v3 2/2] test: resource_scheduling: use score_nodes helper to imitate HA Manager Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 1/8] manager: remove redundant recompute_online_node_usage from next_state_recovery Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 2/8] manager: remove redundant add_service_usage_to_node " Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 3/8] manager: remove redundant add_service_usage_to_node from next_state_started Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 4/8] rules: resource affinity: decouple get_resource_affinity helper from Usage class Daniel Kral
2025-11-03 15:50   ` Michael Köppl
2025-11-03 16:01     ` Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 5/8] manager: make recompute_online_node_usage use add_service_usage helper Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 6/8] usage: allow granular changes to Usage implementations Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 7/8] manager: make online node usage computation granular Daniel Kral
2025-10-27 16:43 ` [pve-devel] [PATCH ha-manager v3 8/8] implement static service stats cache Daniel Kral
2025-11-14 10:13 ` [pve-devel] superseded: [PATCH ha-manager/perl-rs/proxmox v3 00/11] Granular online_node_usage accounting Daniel Kral

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=DE7FYOAE3G46.1O7MN0LT1M03G@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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