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 4E2C31FF16F for ; Tue, 2 Sep 2025 10:10:49 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 665AEBFD2; Tue, 2 Sep 2025 10:11:01 +0200 (CEST) Mime-Version: 1.0 Date: Tue, 02 Sep 2025 10:10:27 +0200 Message-Id: Cc: "pve-devel" From: "Daniel Kral" To: "Proxmox VE development discussion" X-Mailer: aerc 0.20.0 References: <20250821143705.256562-1-d.kral@proxmox.com> <20250821143705.256562-17-d.kral@proxmox.com> In-Reply-To: <20250821143705.256562-17-d.kral@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1756800614441 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 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 0.001 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 0.001 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 0.001 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [status.pm] Subject: Re: [pve-devel] [PATCH ha-manager 16/18] api: status: sync active service counting with lrm's helper X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Thu Aug 21, 2025 at 4:35 PM CEST, Daniel Kral wrote: > diff --git a/src/PVE/API2/HA/Status.pm b/src/PVE/API2/HA/Status.pm > index 6e13c2c8..3d9aabaa 100644 > --- a/src/PVE/API2/HA/Status.pm > +++ b/src/PVE/API2/HA/Status.pm > @@ -197,13 +197,21 @@ __PACKAGE__->register_method({ > my $active_count = {}; > foreach my $sid (sort keys %{ $status->{service_status} }) { > my $sd = $status->{service_status}->{$sid}; > + my $target = $sd->{target}; # count as active if we are the target. > next if !$sd->{node}; > $active_count->{ $sd->{node} } = 0 if !defined($active_count->{ $sd->{node} }); > my $req_state = $sd->{state}; > next if !defined($req_state); > next if $req_state eq 'stopped'; > next if $req_state eq 'freeze'; > + next if $req_state eq 'error'; > + next if $req_state eq 'request_start'; > $active_count->{ $sd->{node} }++; > + > + if ($target && $target ne $sd->{node}) { > + $active_count->{$target} = 0 if !defined($active_count->{$target}); > + $active_count->{$target}++; > + } @Michael and I noticed that this (intermediate) change doesn't account for cases where $sd->{node} is falsy but $sd->{target} is set, which doesn't make it equal to the lrm's helper. I'll see what I'll do for a v2, but I'll either just fix it in-place or move the whole thing into the loop below already, so that $active_count is already scalar instead of a hash reference, so it's simpler to see in the last patch that using the introduced helper is valid. > } > > foreach my $node (sort keys %{ $status->{node_status} }) { _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel