public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ha-manager v2 1/1] fix #6881: api: relocate resource: fix check to avoid Perl warning
Date: Thu,  2 Oct 2025 15:50:02 +0200	[thread overview]
Message-ID: <20251002135011.136664-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251002135011.136664-1-f.ebner@proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      reply	other threads:[~2025-10-02 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 13:50 [pve-devel] [PATCH ha-manager v2 0/1] " Fiona Ebner
2025-10-02 13:50 ` Fiona Ebner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251002135011.136664-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal