From: Elias Huhsovitz <e.huhsovitz@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Elias Huhsovitz <e.huhsovitz@proxmox.com>
Subject: [qemu-server] fix #5040: qm: migrate: prevent perl error on missing mapped devices
Date: Wed, 15 Jul 2026 13:05:45 +0200 [thread overview]
Message-ID: <20260715110545.83658-1-e.huhsovitz@proxmox.com> (raw)
When a VM configuration references a mapped device (USB, PCI, or
directory) that does not exist in the cluster's mapping configuration,
the `PVE::Mapping::*::get_node_mapping` functions return `undef`.
The migration attempted to dereference the result directly,
which caused an error:
Can't use an undefined value as an ARRAY reference at .../Helpers.pm
Check if the returned entry is defined before attempting to dereference
it as an array. This allows the migration check to gracefully handle
missing mappings and report them to the user.
Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
---
src/PVE/QemuMigrate/Helpers.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/QemuMigrate/Helpers.pm b/src/PVE/QemuMigrate/Helpers.pm
index 466517da..c0e54831 100644
--- a/src/PVE/QemuMigrate/Helpers.pm
+++ b/src/PVE/QemuMigrate/Helpers.pm
@@ -60,7 +60,7 @@ sub check_local_resources {
} elsif ($type eq 'dir') {
$entry = PVE::Mapping::Dir::get_node_mapping($dir_map, $id, $node);
}
- if (!scalar($entry->@*)) {
+ if (!$entry || !scalar($entry->@*)) {
push @{ $missing_mappings_by_node->{$node} }, $key;
}
}
--
2.47.3
reply other threads:[~2026-07-15 11:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260715110545.83658-1-e.huhsovitz@proxmox.com \
--to=e.huhsovitz@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