From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4D9C61FF13A for ; Wed, 29 Apr 2026 14:21:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7B6C4CE0; Wed, 29 Apr 2026 14:21:33 +0200 (CEST) From: Dominik Rusovac To: pve-devel@lists.proxmox.com Subject: [PATCH pve-ha-manager v2 5/6] api: status: add load imbalance to status Date: Wed, 29 Apr 2026 14:20:50 +0200 Message-ID: <20260429122051.179485-6-d.rusovac@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260429122051.179485-1-d.rusovac@proxmox.com> References: <20260429122051.179485-1-d.rusovac@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1777465161296 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.404 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 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: WJPRJMTVYYJC2QKRNCF2MIFU4KU3A5FM X-Message-ID-Hash: WJPRJMTVYYJC2QKRNCF2MIFU4KU3A5FM 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: This is a very basic measure to enable users to detect the prevailing load imbalance in the UI, which atm reveals nothing about the latter. imo, enabling users to track how the load imbalance changed over time (using RRD graphs, for example) should be considered, in the long run. Signed-off-by: Dominik Rusovac --- Notes: changes since v1: * check whether load balancing system is enabled * binding $crs->{ha} to $mode src/PVE/API2/HA/Status.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm index 4894f3b..8dadff3 100644 --- a/src/PVE/API2/HA/Status.pm +++ b/src/PVE/API2/HA/Status.pm @@ -199,8 +199,11 @@ __PACKAGE__->register_method({ } my $datacenter_config = eval { cfs_read_file('datacenter.cfg') } // {}; if (my $crs = $datacenter_config->{crs}) { - $extra_status .= " - $crs->{ha} load CRS" - if $crs->{ha} && $crs->{ha} ne 'basic'; + my $mode = $crs->{ha}; + $extra_status .= + " - $mode load CRS " + . sprintf("(load imbalance: %.2f", 100 * $status->{imbalance}) . "%)" + if $crs->{'ha-auto-rebalance'} && $mode && $mode ne 'basic'; } my $time_str = localtime($status->{timestamp}); my $status_text = "$master ($status_str, $time_str)$extra_status"; -- 2.47.3