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 <[email protected]>
---
 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



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to