[pve-devel] [PATCH ha-manager v2 10/12] config: factor out checked_resources_config helper
Daniel Kral
d.kral at proxmox.com
Tue Jan 20 16:27:42 CET 2026
This allows future users to retrieve the checked resource config if
these already have a parsed resource config instead of reading it twice.
Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
changes v1 -> v2:
- new!
src/PVE/HA/Config.pm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm
index d01b43d8..7607b194 100644
--- a/src/PVE/HA/Config.pm
+++ b/src/PVE/HA/Config.pm
@@ -105,10 +105,9 @@ sub read_resources_config {
return cfs_read_file($ha_resources_config);
}
-# checks if resource exists and sets defaults for unset values
-sub read_and_check_resources_config {
-
- my $cfg = cfs_read_file($ha_resources_config);
+# returns resources config with defaults and node placement set
+my sub checked_resources_config {
+ my ($cfg) = @_;
my $vmlist = PVE::Cluster::get_vmlist();
my $resources = {};
@@ -137,6 +136,13 @@ sub read_and_check_resources_config {
return wantarray ? ($resources, $cfg->{digest}) : $resources;
}
+# checks if resource exists and sets defaults for unset values
+sub read_and_check_resources_config {
+ my $cfg = cfs_read_file($ha_resources_config);
+
+ return checked_resources_config($cfg);
+}
+
my sub update_single_resource_config_inplace {
my ($cfg, $sid, $param, $delete) = @_;
--
2.47.3
More information about the pve-devel
mailing list