all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [qemu-server] fix #5040: qm: migrate: prevent perl error on missing mapped devices
@ 2026-07-15 11:05 Elias Huhsovitz
  0 siblings, 0 replies; only message in thread
From: Elias Huhsovitz @ 2026-07-15 11:05 UTC (permalink / raw)
  To: pve-devel; +Cc: Elias Huhsovitz

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





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-15 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 11:05 [qemu-server] fix #5040: qm: migrate: prevent perl error on missing mapped devices Elias Huhsovitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal