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 E4CAF1FF0AF for ; Fri, 20 Nov 2026 14:54:21 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id C635D2175E; Fri, 20 Nov 2026 14:54:20 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 20 Nov 2026 14:54:16 +0100 Message-Id: Subject: Re: [PATCH pve-ha-manager v2 16/19] manager: log changes to crs settings From: "Daniel Kral" To: "Dominik Rusovac" , X-Mailer: aerc 0.22.0-45-gc30c872fde7b-dirty References: <20261112094437.1951271-1-d.rusovac@proxmox.com> <20261112094437.1951271-17-d.rusovac@proxmox.com> In-Reply-To: <20261112094437.1951271-17-d.rusovac@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795182856470 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.420 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: MHTXPJBOHXHV7ZAHOIVFQIPJ4CFEPBBT X-Message-ID-Hash: MHTXPJBOHXHV7ZAHOIVFQIPJ4CFEPBBT 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: Nice! Besides the nits, consider as: Reviewed-by: Daniel Kral On Thu Nov 12, 2026 at 10:44 AM CET, Dominik Rusovac wrote: > log the CRS settings when they are first read with non-default values > and whenever they change, so that it can be traced how the load balancer > is configured > > Signed-off-by: Dominik Rusovac > --- > > Notes: > changes since v1: > * use the update_crs_option() helper, which also logs non-default > values when they are first read > * keep the log messages for the scheduler mode > * adjust test logs > * reword commit > > src/PVE/HA/Manager.pm | 49 +++++++++++++++---- > .../log.expect | 2 + > .../log.expect | 2 + > .../log.expect | 2 + > .../log.expect | 3 ++ > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 2 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 2 + > .../log.expect | 1 + > .../test-crs-dynamic-rebalance1/log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 1 + > .../log.expect | 4 ++ > .../test-crs-static-rebalance1/log.expect | 1 + > .../test-crs-static-rebalance2/log.expect | 1 + > 22 files changed, 70 insertions(+), 10 deletions(-) > > diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm > index a91eec3..7de8781 100644 > --- a/src/PVE/HA/Manager.pm > +++ b/src/PVE/HA/Manager.pm > @@ -132,18 +132,47 @@ sub update_crs_settings { > 'basic', > ); > =20 > - $self->{crs}->{rebalance_on_request_start} =3D !!$crs_cfg->{'ha-reba= lance-on-start'}; > - $self->{crs}->{auto_rebalance}->{enable} =3D !!$crs_cfg->{'ha-auto-r= ebalance'}; > + my $crs =3D $self->{crs}; nit: introduce and use the $crs in the previous patch already, so it can be used to reference $crs->{scheduler} > + my $auto_rebalance =3D $crs->{auto_rebalance}; nit: put this either next to $crs as well or right above the update_crs_option() call for 'ha-auto-rebalance' > + > + $self->update_crs_option( > + 'ha-rebalance-on-start', > + \$crs->{rebalance_on_request_start}, > + $crs_cfg->{'ha-rebalance-on-start'}, > + 0, > + ); > + $self->update_crs_option( > + 'ha-auto-rebalance', > + \$auto_rebalance->{enable}, > + $crs_cfg->{'ha-auto-rebalance'}, > + 0, > + ); > # configured as percent for UI/config consistency, scaled to [0, 1] = to match the > # internal imbalance value that the comparison gates against. > - $self->{crs}->{auto_rebalance}->{threshold} =3D > - ($crs_cfg->{'ha-auto-rebalance-threshold'} // 30) / 100.0; > - $self->{crs}->{auto_rebalance}->{method} =3D $crs_cfg->{'ha-auto-reb= alance-method'} > - // 'bruteforce'; > - $self->{crs}->{auto_rebalance}->{hold_duration} =3D $crs_cfg->{'ha-a= uto-rebalance-hold-duration'} > - // 3; > - $self->{crs}->{auto_rebalance}->{margin} =3D > - ($crs_cfg->{'ha-auto-rebalance-margin'} // 10) / 100.0; > + $self->update_crs_option( > + 'ha-auto-rebalance-threshold', > + \$auto_rebalance->{threshold}, > + ($crs_cfg->{'ha-auto-rebalance-threshold'} // 30) / 100.0, > + 0.3, > + ); > + $self->update_crs_option( > + 'ha-auto-rebalance-method', > + \$auto_rebalance->{method}, > + $crs_cfg->{'ha-auto-rebalance-method'}, > + 'bruteforce', > + ); > + $self->update_crs_option( > + 'ha-auto-rebalance-hold-duration', > + \$auto_rebalance->{hold_duration}, > + $crs_cfg->{'ha-auto-rebalance-hold-duration'}, > + 3, > + ); > + $self->update_crs_option( > + 'ha-auto-rebalance-margin', > + \$auto_rebalance->{margin}, > + ($crs_cfg->{'ha-auto-rebalance-margin'} // 10) / 100.0, > + 0.1, > + ); > =20 > return; > }