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 8B4BF1FF137 for ; Tue, 31 Mar 2026 15:55:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3D9BF1E7F1; Tue, 31 Mar 2026 15:56:02 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 31 Mar 2026 15:55:54 +0200 Message-Id: Subject: Re: [PATCH ha-manager v3 35/40] implement automatic rebalancing From: "Daniel Kral" To: "Dominik Rusovac" , =?utf-8?q?Michael_K=C3=B6ppl?= , X-Mailer: aerc 0.21.0-38-g7088c3642f2c-dirty References: <20260330144101.668747-1-d.kral@proxmox.com> <20260330144101.668747-36-d.kral@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774965299108 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.425 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: JF7H7IALKPHH4NLAXWF3JYY3EBE7ANUX X-Message-ID-Hash: JF7H7IALKPHH4NLAXWF3JYY3EBE7ANUX 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 Tue Mar 31, 2026 at 11:39 AM CEST, Dominik Rusovac wrote: > On Tue Mar 31, 2026 at 11:32 AM CEST, Daniel Kral wrote: >> Good catch, thanks to you both! >> >> Even though it's unpractical, users can still set the threshold to 0.0, >> which could actually cause a division by zero here, because the >> threshold is compared by a >=3D relation. >> [...] >> >> The system is rather unstable in that regard anyway (same if $margin =3D >> 0.0), because it always tries to load balance every $hold_duration HA >> rounds. >> >> I'm not sure whether we should prevent this with adjusting the range for >> both the threshold and margin to be at least larger than some minimum >> value, so that the load balancing system won't become unstable. >> > > yeah, either this, or you add a guard to return early (before the > threshold guard) whenever imbalance is 0.0, I guess As discussed off-list, I think it's reasonable to allow an imbalance $threshold of 0.0, but even then a current $imbalance of 0.0 shouldn't trigger that, so I'll change the comparison above to a '>' relation instead of a '>=3D' relation. An imbalance $threshold =3D 0.0 could mean 'try to always find a load balancing migration'. Though very aggressive, it doesn't do any harm in itself and doesn't mean the load balancing system will commit to a rebalancing migration after all. However, setting $margin =3D 0.0 will indicate that any migration - even if it doesn't change the imbalance at all - will be committed. But after all this is a user configuration and we should check in the datacenter config that the values aren't invalid (e.g. negative values) and add to the {verbose_,}description that the value of 0.0 might not be what users want, but can still do.