[pve-devel] [PATCH ha-manager v2 1/1] fix #6881: api: relocate resource: fix check to avoid Perl warning

Fiona Ebner f.ebner at proxmox.com
Thu Oct 2 15:50:02 CEST 2025


The resource relocation endpoint would produce a warning when there
are no blocking resources on the target node:
> Can't use an undefined value as an ARRAY reference

Align the relocation endpoint to do the check in the same manner as
the migration endpoint to avoid the warning.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

Changes in v2:
* Alternative approach, align check for relocation with how it's done
  for migration. This avoids the need to adapt callers outside the
  ha-manager package, which v1 failed to do.

 src/PVE/API2/HA/Resources.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index 894fe90..acdd499 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -495,7 +495,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;
     },
-- 
2.47.3





More information about the pve-devel mailing list