From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id A63DC1FF183
	for <inbox@lore.proxmox.com>; Wed, 21 May 2025 15:10:20 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id EE5B718F62;
	Wed, 21 May 2025 15:10:16 +0200 (CEST)
Message-ID: <c2b16209-2edd-4090-89fa-40be0572a272@proxmox.com>
Date: Wed, 21 May 2025 15:09:43 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Markus Frank <m.frank@proxmox.com>
References: <20250307092546.102655-1-m.frank@proxmox.com>
 <20250307092546.102655-3-m.frank@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20250307092546.102655-3-m.frank@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.033 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: Re: [pve-devel] [PATCH qemu-server v3 2/4] fix 4888: qmrestore: add
 disk-format option
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Am 07.03.25 um 10:25 schrieb Markus Frank:
> Add an option to choose a file format (qcow2, raw, vmdk) when restoring
> a vm backup to file based storage. This options allows all disks to be
> recreated with the specified file format if supported by the target
> storage.
> 
> Signed-off-by: Markus Frank <m.frank@proxmox.com>

Looks good to me, but some slight changes would be nice, see below:

Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>

> ---
> v3:
> * added requires => 'archive' to disk-format
> * changed descriptions
> * added missing imports/uses
> * check if disk_format is in validFormats
> 
>  PVE/API2/Qemu.pm     |  7 +++++++
>  PVE/CLI/qmrestore.pm |  5 +++++
>  PVE/QemuServer.pm    | 14 +++++++++-----
>  3 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 5ac61aa5..3f4d19cc 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm

Should add an include for PVE::Storage::Common if you make the requested
change for 1/4. I guess it would be inherited implicitly, but it's nicer
to explicitly include it.

> diff --git a/PVE/CLI/qmrestore.pm b/PVE/CLI/qmrestore.pm
> index a47648bd..9910f30d 100755
> --- a/PVE/CLI/qmrestore.pm
> +++ b/PVE/CLI/qmrestore.pm
> @@ -3,6 +3,7 @@ package PVE::CLI::qmrestore;
>  use strict;
>  use warnings;
>  use PVE::SafeSyslog;
> +use PVE::Storage;

Should be PVE::Storage::Common if you make the requested change for 1/4.

> @@ -7064,7 +7068,7 @@ sub restore_proxmox_backup_archive {
>  	$restore_cleanup_oldconf->($storecfg, $vmid, $oldconf, $virtdev_hash) if $oldconf;
>  
>  	# allocate volumes
> -	my $map = $restore_allocate_devices->($storecfg, $virtdev_hash, $vmid);
> +	my $map = $restore_allocate_devices->($storecfg, $virtdev_hash, $vmid, $options->{disk_format});
>  
>  	foreach my $virtdev (sort keys %$virtdev_hash) {
>  	    my $d = $virtdev_hash->{$virtdev};
> @@ -7461,7 +7465,7 @@ sub restore_vma_archive {
>  	}
>  
>  	# allocate volumes
> -	my $map = $restore_allocate_devices->($cfg, $virtdev_hash, $vmid);
> +	my $map = $restore_allocate_devices->($cfg, $virtdev_hash, $vmid, $opts->{disk_format});
>  
>  	# print restore information to $fifofh
>  	foreach my $virtdev (sort keys %$virtdev_hash) {

There's a restore_external_archive() function that also calls
$restore_allocate_devices->() now which should be adapted too.


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