[pve-devel] [PATCH qemu-server v9 16/29] image convert: allow caller to specify the format of the source path
Fiona Ebner
f.ebner at proxmox.com
Fri Apr 4 15:31:51 CEST 2025
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>
---
PVE/QemuServer.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b3b71c79..70b74b96 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -7769,6 +7769,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) = @_;
@@ -7794,7 +7796,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