[pve-devel] applied: [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Apr 19 08:59:16 CEST 2024


On April 19, 2024 8:51 am, Dominik Csapak wrote:
> 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 at proxmox.com>
> ---
> i did not add a 'fixes' trailer, because when the patch was written
> there was no 'import' content-type where that could have failed.
> 
> also at the time the 'import' was written, the patch checking for unused
> was not applied yet, so there no fault there too..
> 
> 
>  PVE/QemuServer.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 661613df..28e630d3 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -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) {
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list