From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B2A051FF141 for ; Mon, 30 Mar 2026 09:54:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E3F6619347; Mon, 30 Mar 2026 09:54:46 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 30 Mar 2026 09:54:42 +0200 Message-Id: Subject: Re: [PATCH ha-manager v2 28/40] usage: pass service data to get_used_service_nodes From: "Dominik Rusovac" To: "Daniel Kral" , X-Mailer: aerc 0.20.0 References: <20260324183029.1274972-1-d.kral@proxmox.com> <20260324183029.1274972-29-d.kral@proxmox.com> In-Reply-To: <20260324183029.1274972-29-d.kral@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774857228755 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.160 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: KCMMKPFPHCRBY3RRJQMG7PNCCWN4DAGS X-Message-ID-Hash: KCMMKPFPHCRBY3RRJQMG7PNCCWN4DAGS X-MailFrom: d.rusovac@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: lgtm, consider modulo nit On Tue Mar 24, 2026 at 7:30 PM CET, Daniel Kral wrote: > Remove some unnecessary destructuring syntax for the helper. > > Signed-off-by: Daniel Kral > --- > changes v1 -> v2: > - new! > [snip] > diff --git a/src/PVE/HA/Usage.pm b/src/PVE/HA/Usage.pm > index 6d53f956..5f1ac226 100644 > --- a/src/PVE/HA/Usage.pm > +++ b/src/PVE/HA/Usage.pm > @@ -45,9 +45,7 @@ sub add_service_usage { > my ($self, $sid, $sd) =3D @_; > =20 > my $online_nodes =3D { map { $_ =3D> 1 } $self->list_nodes() }; > - my ($service_state, $service_node, $migration_target) =3D $sd->@{qw(= state node target)}; > - my ($current_node, $target_node) =3D > - get_used_service_nodes($online_nodes, $service_state, $service_n= ode, $migration_target); > + my ($current_node, $target_node) =3D get_used_service_nodes($online_= nodes, $sd); > =20 > $self->add_service_usage_to_node($current_node, $sid) if $current_no= de; > $self->add_service_usage_to_node($target_node, $sid) if $target_node= ; > @@ -67,10 +65,11 @@ sub score_nodes_to_start_service { > } > =20 > # Returns the current and target node as a two-element array, that a ser= vice > -# puts load on according to the $online_nodes and the service's $state, = $node > -# and $target. > +# puts load on according to the $online_nodes and the service data $sd. nit: consider rewording: # Returns a two-element array of the nodes a service puts load on # (current and target), given $online_nodes and service data $sd. > sub get_used_service_nodes { > - my ($online_nodes, $state, $node, $target) =3D @_; > + my ($online_nodes, $sd) =3D @_; > + > + my ($state, $node, $target) =3D $sd->@{qw(state node target)}; > =20 > return (undef, undef) if $state eq 'stopped' || $state eq 'request_s= tart'; > =20 Reviewed-by: Dominik Rusovac