[pve-devel] [PATCH ha-manager 3/7] sim: hardware: initialize default fallback static_service_stats

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


Otherwise the already defined HA resources in the service config will
not have valid static service stats.

This intentionally doesn't set default values for HA resources, which
don't have any static service stats set, if the static_service_stats
file exists, to prevent test cases relying on fallback values.

Currently, test cases do not depend on any automatically generated
config files. In the future, creating these files as fallbacks should be
moved to the pve-ha-simulator entirely to prevent test cases relying on
them anyway.

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

diff --git a/src/PVE/HA/Sim/Hardware.pm b/src/PVE/HA/Sim/Hardware.pm
index 41d21326..9bc753dd 100644
--- a/src/PVE/HA/Sim/Hardware.pm
+++ b/src/PVE/HA/Sim/Hardware.pm
@@ -488,6 +488,10 @@ sub new {
 
     if (-f "$testdir/static_service_stats") {
         copy("$testdir/static_service_stats", "$statusdir/static_service_stats");
+    } else {
+        my $services = $self->read_service_config();
+        my $stats = { map { $_ => { maxcpu => 4, maxmem => 4096 } } keys %$services };
+        $self->write_static_service_stats($stats);
     }
 
     my $cstatus = $self->read_hardware_status_nolock();
-- 
2.47.3





More information about the pve-devel mailing list