From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 14BCF1FF380 for ; Fri, 19 Apr 2024 08:59:54 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C7AFC37EBB; Fri, 19 Apr 2024 08:59:52 +0200 (CEST) Date: Fri, 19 Apr 2024 08:59:16 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20240419065154.148615-1-d.csapak@proxmox.com> In-Reply-To: <20240419065154.148615-1-d.csapak@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1713509943.r1x48tmtz1.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] applied: [PATCH qemu-server] clone disk: prevent 'uninitialized value' warning for unused check X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 > --- > 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