5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-07 17:17:57 +03:00

clone disk: prevent 'uninitialized value' warning for unused check

since commit
1f743141 (fix #1905: Allow moving unused disks)

we want to check the source drive name for 'unused', but in case of
importing a volume from the 'import' content type (e.g. from esxi),
there is no source drive name. So we have to first check if it's
defined.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2024-04-19 08:51:54 +02:00 committed by Fabian Grünbichler
parent 9f3651d9b7
commit 4fd49b4a04

View File

@ -8154,7 +8154,7 @@ sub clone_disk {
my ($newvmid, $dst_drivename, $efisize) = $dest->@{qw(vmid drivename efisize)};
my ($storage, $format) = $dest->@{qw(storage format)};
my $unused = $src_drivename =~ /^unused/;
my $unused = defined($src_drivename) && $src_drivename =~ /^unused/;
my $use_drive_mirror = $full && $running && $src_drivename && !$snapname && !$unused;
if ($src_drivename && $dst_drivename && $src_drivename ne $dst_drivename) {