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 <[email protected]> --- 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 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
