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 8AECB1FF137 for ; Tue, 17 Feb 2026 15:15:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F1DFF2AF6; Tue, 17 Feb 2026 15:15:05 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [RFC ha-manager 07/21] make static service stats indexable by sid Date: Tue, 17 Feb 2026 15:14:14 +0100 Message-ID: <20260217141437.584852-21-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260217141437.584852-1-d.kral@proxmox.com> References: <20260217141437.584852-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: 1771337677433 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 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: GRN3BW7NXSCOUOGHSQJOH6R2NLVK3PMN X-Message-ID-Hash: GRN3BW7NXSCOUOGHSQJOH6R2NLVK3PMN 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 78ece447..1a9dc4ea 100644 --- a/src/PVE/HA/Env/PVE2.pm +++ b/src/PVE/HA/Env/PVE2.pm @@ -527,10 +527,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 c40c260f..ea7655e5 100644 --- a/src/PVE/HA/Resources.pm +++ b/src/PVE/HA/Resources.pm @@ -183,7 +183,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 2bde9aa3..f91d3ea2 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