mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 22:35:35 +00:00
image convert: allow caller to specify the format of the source path
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@proxmox.com> Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Link: https://lore.proxmox.com/20250404133204.239783-17-f.ebner@proxmox.com
This commit is contained in:
parent
d5d3501a0b
commit
ebaf90d61c
@ -7775,6 +7775,8 @@ sub convert_iscsi_path {
|
|||||||
# bwlimit - The bandwidth limit in KiB/s.
|
# bwlimit - The bandwidth limit in KiB/s.
|
||||||
# is-zero-initialized - If the destination image is zero-initialized.
|
# is-zero-initialized - If the destination image is zero-initialized.
|
||||||
# snapname - Use this snapshot of the source image.
|
# 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 {
|
sub qemu_img_convert {
|
||||||
my ($src_volid, $dst_volid, $size, $opts) = @_;
|
my ($src_volid, $dst_volid, $size, $opts) = @_;
|
||||||
|
|
||||||
@ -7800,7 +7802,9 @@ sub qemu_img_convert {
|
|||||||
$cachemode = 'none' if $src_scfg->{type} eq 'zfspool';
|
$cachemode = 'none' if $src_scfg->{type} eq 'zfspool';
|
||||||
} elsif (-f $src_volid || -b $src_volid) {
|
} elsif (-f $src_volid || -b $src_volid) {
|
||||||
$src_path = $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;
|
$src_format = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user