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 35B7B1FF13C for ; Thu, 02 Apr 2026 14:49:40 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BDE6917304; Thu, 2 Apr 2026 14:48:59 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH cluster v4 03/28] datacenter config: add auto rebalancing options Date: Thu, 2 Apr 2026 14:43:57 +0200 Message-ID: <20260402124817.416232-4-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260402124817.416232-1-d.kral@proxmox.com> References: <20260402124817.416232-1-d.kral@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775134042669 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.421 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: LWZY5DSAYSVMJZHUT5ZHFTXRCQQPSMCM X-Message-ID-Hash: LWZY5DSAYSVMJZHUT5ZHFTXRCQQPSMCM 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: These options control the behavior of the load balancing system in the HA Manager. The imbalance threshold default value is set to `0.3`, as experimentation with some common cluster sizes showed good results. This might need more adaption in the future, such as a cluster-size-dependent profile setting to find a better threshold default value. Another inbalance threshold default value, which was considered, was `0.15`, which is the minimum threshold to detect an imbalance in a cluster with one node with load 0.0 and the other nodes with load 1.0 for a cluster size of up to 45 nodes. For cluster size N, this is derived with: node_loads = [0.0] + [1.0 for _ in range(N-1)] min_imbalance = calculate_node_imbalance(node_loads) Though a good starting metric, the imbalance threshold of `0.15` would be too sensitive for small cluster sizes and `0.3` was a better balance for that. Signed-off-by: Daniel Kral --- changes v3 -> v4: - change threshold default value from 0.7 to 0.3 - add minimum requirements to number fields src/PVE/DataCenterConfig.pm | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/PVE/DataCenterConfig.pm b/src/PVE/DataCenterConfig.pm index 0225bc6..6513594 100644 --- a/src/PVE/DataCenterConfig.pm +++ b/src/PVE/DataCenterConfig.pm @@ -33,6 +33,50 @@ EODESC "Set to use CRS for selecting a suited node when a HA services request-state" . " changes from stop to start.", }, + 'ha-auto-rebalance' => { + type => 'boolean', + optional => 1, + default => 0, + description => "Whether to use CRS for balancing HA resources automatically" + . " depending on the current node imbalance.", + }, + 'ha-auto-rebalance-threshold' => { + type => 'number', + optional => 1, + minimum => 0.0, + default => 0.3, + requires => 'ha-auto-rebalance', + description => "The threshold for the cluster node imbalance, which will" + . " trigger the automatic resource balancing system if its value" + . " is exceeded.", + }, + 'ha-auto-rebalance-method' => { + type => 'string', + enum => ['bruteforce', 'topsis'], + optional => 1, + default => 'bruteforce', + requires => 'ha-auto-rebalance', + description => "The method to use for the scoring of balancing migrations.", + }, + 'ha-auto-rebalance-hold-duration' => { + type => 'number', + optional => 1, + minimum => 0, + default => 3, + requires => 'ha-auto-rebalance', + description => "The number of HA rounds for which the cluster node" + . " imbalance threshold must be exceeded before triggering an" + . " automatic resource balancing migration.", + }, + 'ha-auto-rebalance-margin' => { + type => 'number', + optional => 1, + minimum => 0.0, + default => 0.1, + requires => 'ha-auto-rebalance', + description => "The minimum relative improvement in cluster node" + . " imbalance to commit to a resource balancing migration.", + }, }; my $migration_format = { -- 2.47.3