public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check
@ 2024-04-19  6:51 Dominik Csapak
  2024-04-19  6:59 ` [pve-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2024-04-19  6:51 UTC (permalink / raw)
  To: pve-devel

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>
---
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@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check
  2024-04-19  6:51 [pve-devel] [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check Dominik Csapak
@ 2024-04-19  6:59 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2024-04-19  6:59 UTC (permalink / raw)
  To: Proxmox VE development discussion

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@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@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-19  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19  6:51 [pve-devel] [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check Dominik Csapak
2024-04-19  6:59 ` [pve-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal