[pve-devel] [PATCH v8 qemu-server 07/11] image convert: allow caller to specify the format of the source path

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Apr 3 14:31:05 CEST 2025


From: Fiona Ebner <f.ebner at proxmox.com>

In preparation for the restore API for backup providers that doesn't
want detection based on the file extension but always requires raw.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
No changes to v7.

 PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5c6cb94..93f985b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -7791,6 +7791,8 @@ sub convert_iscsi_path {
 # bwlimit - The bandwidth limit in KiB/s.
 # is-zero-initialized - If the destination image is zero-initialized.
 # snapname - Use this snapshot of the source image.
+# source-path-format - Indicate the format of the source when the source is a path. For PVE-managed
+# volumes, the format from the storage layer is always used.
 sub qemu_img_convert {
     my ($src_volid, $dst_volid, $size, $opts) = @_;
 
@@ -7816,7 +7818,9 @@ sub qemu_img_convert {
 	$cachemode = 'none' if $src_scfg->{type} eq 'zfspool';
     } elsif (-f $src_volid || -b $src_volid) {
 	$src_path = $src_volid;
-	if ($src_path =~ m/\.($PVE::QemuServer::Drive::QEMU_FORMAT_RE)$/) {
+	if ($opts->{'source-path-format'}) {
+	    $src_format = $opts->{'source-path-format'};
+	} elsif ($src_path =~ m/\.($PVE::QemuServer::Drive::QEMU_FORMAT_RE)$/) {
 	    $src_format = $1;
 	}
     }
-- 
2.39.5





More information about the pve-devel mailing list