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 9861C1FF13C for ; Thu, 19 Mar 2026 17:40:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 199BA5C6A; Thu, 19 Mar 2026 17:41:01 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH ha-manager v2 07/10] make static service stats indexable by sid Date: Thu, 19 Mar 2026 17:33:57 +0100 Message-ID: <20260319164047.642936-8-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260319164047.642936-1-d.kral@proxmox.com> References: <20260319164047.642936-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: 1773938408245 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.052 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: E4EVRVTC34BKFW3CGQIAADLEVHXHRPSH X-Message-ID-Hash: E4EVRVTC34BKFW3CGQIAADLEVHXHRPSH 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: Signed-off-by: Daniel Kral --- src/PVE/HA/Env/PVE2.pm | 3 ++- src/PVE/HA/Resources.pm | 2 +- src/PVE/HA/Resources/PVECT.pm | 4 ++-- src/PVE/HA/Resources/PVEVM.pm | 4 ++-- src/PVE/HA/Sim/Resources.pm | 3 +-- src/PVE/HA/Usage/Static.pm | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm index 94f30d73..54270a40 100644 --- a/src/PVE/HA/Env/PVE2.pm +++ b/src/PVE/HA/Env/PVE2.pm @@ -532,10 +532,11 @@ sub update_static_service_stats { my $type = eval { PVE::HA::Tools::get_ha_resource_type($idlist->{$id}->{type}) }; next if $@; # silently ignore unknown pve types + my $sid = "$type:$id"; my $conf = $confs->{$id} // {}; my $plugin = PVE::HA::Resources->lookup($type); - $stats->{$id} = $plugin->get_static_stats_from_config($conf); + $stats->{$sid} = $plugin->get_static_stats_from_config($conf); } return $stats; diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm index cba2d4c2..01facac8 100644 --- a/src/PVE/HA/Resources.pm +++ b/src/PVE/HA/Resources.pm @@ -184,7 +184,7 @@ sub get_static_stats_from_config { } sub get_static_stats { - my ($class, $haenv, $id) = @_; + my ($class, $haenv, $sid) = @_; die "implement in subclass"; } diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm index 0dc500d1..bda33717 100644 --- a/src/PVE/HA/Resources/PVECT.pm +++ b/src/PVE/HA/Resources/PVECT.pm @@ -169,9 +169,9 @@ sub get_static_stats_from_config { } sub get_static_stats { - my ($class, $haenv, $id) = @_; + my ($class, $haenv, $sid) = @_; - return $haenv->get_static_service_stats($id); + return $haenv->get_static_service_stats($sid); } 1; diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm index 579a7fca..786c5130 100644 --- a/src/PVE/HA/Resources/PVEVM.pm +++ b/src/PVE/HA/Resources/PVEVM.pm @@ -190,9 +190,9 @@ sub get_static_stats_from_config { } sub get_static_stats { - my ($class, $haenv, $id) = @_; + my ($class, $haenv, $sid) = @_; - return $haenv->get_static_service_stats($id); + return $haenv->get_static_service_stats($sid); } 1; diff --git a/src/PVE/HA/Sim/Resources.pm b/src/PVE/HA/Sim/Resources.pm index ad52437d..ed7d9c5a 100644 --- a/src/PVE/HA/Sim/Resources.pm +++ b/src/PVE/HA/Sim/Resources.pm @@ -138,9 +138,8 @@ sub remove_locks { } sub get_static_stats { - my ($class, $haenv, $id) = @_; + my ($class, $haenv, $sid) = @_; - my $sid = $class->type() . ":$id"; my $hardware = $haenv->hardware(); return $hardware->get_static_service_stats($sid); diff --git a/src/PVE/HA/Usage/Static.pm b/src/PVE/HA/Usage/Static.pm index 2304139c..acc3533c 100644 --- a/src/PVE/HA/Usage/Static.pm +++ b/src/PVE/HA/Usage/Static.pm @@ -65,10 +65,10 @@ my sub get_service_usage { return $self->{'service-stats'}->{$sid} if $self->{'service-stats'}->{$sid}; - my (undef, $type, $id) = $self->{haenv}->parse_sid($sid); + my (undef, $type, undef) = $self->{haenv}->parse_sid($sid); my $plugin = PVE::HA::Resources->lookup($type); - my $stats = eval { $plugin->get_static_stats($self->{haenv}, $id) }; + my $stats = eval { $plugin->get_static_stats($self->{haenv}, $sid) }; die "did not get static service usage information for '$sid'\n" if !$stats; my $service_stats = { -- 2.47.3