From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 405AF1FF0E5 for ; Wed, 15 Jul 2026 13:05:53 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6003D2143E; Wed, 15 Jul 2026 13:05:52 +0200 (CEST) From: Elias Huhsovitz To: pve-devel@lists.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 Message-ID: <20260715110545.83658-1-e.huhsovitz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784113530026 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.282 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: Q7BGIXKMRGCUZ5YRM64HG3SYOZS4N7AY X-Message-ID-Hash: Q7BGIXKMRGCUZ5YRM64HG3SYOZS4N7AY X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Elias Huhsovitz X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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