As reported in the community forum [0], the resource relocation endpoint would produce a warning: > Can't use an undefined value as an ARRAY reference
In the get_resource_motion_info() function, properly initialize the array references in the $blocking_resources_by_node hash to avoid this. Note that the migration endpoint needs to be adapted to only include 'blocking-resources' in the result if there is at least one entry in the array to be compatible with this change. Align the behavior of both migration and relocation endpoints, so that the migration endpoint correctly handles the initialized, but empty array too. Alternatively, it could've been done the other way with the relocation endpoint also checking for the array reference to be undefined if no entries are to be added to the array, but since $comigrated_resources is also initialized when empty, it seemed cleaner to go with the approach here. [0]: https://forum.proxmox.com/threads/173149/ Signed-off-by: Fiona Ebner <[email protected]> --- src/PVE/API2/HA/Resources.pm | 2 +- src/PVE/HA/Config.pm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm index 894fe90..aadddab 100644 --- a/src/PVE/API2/HA/Resources.pm +++ b/src/PVE/API2/HA/Resources.pm @@ -393,7 +393,7 @@ __PACKAGE__->register_method({ my $blocking_resources = $blocking_resources_by_node->{$req_node}; $result->{'comigrated-resources'} = $comigrated_resources if @$comigrated_resources; - $result->{'blocking-resources'} = $blocking_resources if $blocking_resources; + $result->{'blocking-resources'} = $blocking_resources if @$blocking_resources; return $result; }, diff --git a/src/PVE/HA/Config.pm b/src/PVE/HA/Config.pm index 301c62f..b52465f 100644 --- a/src/PVE/HA/Config.pm +++ b/src/PVE/HA/Config.pm @@ -397,6 +397,7 @@ sub get_resource_motion_info { push @$dependent_resources, $_ for sort keys %$together; for my $node (keys %$ns) { + $blocking_resources_by_node->{$node} = []; next if $ns->{$node} ne 'online'; for my $csid (sort keys %$separate) { -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
