[pve-devel] [PATCH ha-manager 4/7] sim: hardware: fix ha resource existence check in set_static_service_stats

Daniel Kral d.kral at proxmox.com
Mon Nov 17 18:21:03 CET 2025


Otherwise this prevents a HA resource to be created, e.g. through the
pve-ha-simulator, as the static service stats for new HA resources is
set with this method.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
 src/PVE/HA/Sim/Hardware.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 9bc753dd..a1381b78 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -181,8 +181,10 @@ sub set_service_state {
 sub set_static_service_stats {
     my ($self, $sid, $new_stats) = @_;
 
+    my $conf = $self->read_service_config();
+    die "no such service '$sid'" if !$conf->{$sid};
+
     my $stats = $self->read_static_service_stats();
-    die "no such service '$sid'" if !$stats->{$sid};
 
     if (my $memory = $new_stats->{maxmem}) {
         print "setting $sid memory to $memory\n" if $memory != $stats->{$sid}->{maxmem};
-- 
2.47.3





More information about the pve-devel mailing list