[pve-devel] [PATCH qemu-server] fix: also add resource mappings that do not exist to missing mappings
Markus Frank
m.frank at proxmox.com
Thu Apr 10 14:14:43 CEST 2025
On 2025-04-10 13:18, Fiona Ebner wrote:
> Am 10.04.25 um 12:59 schrieb Markus Frank:
>> Currently you get a "Can't use an undefined value..." error because all
>> get_node_mapping functions return undefined if there is no resource
>> mapping entry for the id.
>>
>> Fixes: a52eb3c4e ("check local resources: extend for mapped resources")
>> Signed-off-by: Markus Frank <m.frank at proxmox.com>
>> ---
>> This patch supersedes "fix: print error message that the resource
>> mapping entry does not exist"
>>
>> PVE/QemuServer.pm | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index ccdceedc..2790942c 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -2512,7 +2512,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;
>> }
>> }
>
> Looking at this more closely, I think v1 is better actually. Sorry, I
> had misunderstood the exact situation when the issue happens.
I think this patch is actually better (especially for the WebUI).
When I use die, the error is printed in an error window, but the migration window is still open and I can start the migration (which immediately stops and shows the same error again).
With this patch, in the migration window, the key is printed as a mapped resource that is not available on the selected target, which is actually correct (because it is not defined for any node). And I cannot start the migration process.
More information about the pve-devel
mailing list