5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2024-12-23 17:34:19 +03:00

fix #2469: fix qemu-img convert src_format detection

This reverts commit c5151cb8bb which is
a revert of the wrongly done revert of
commit e2414e73ce.
This commit is contained in:
Thomas Lamprecht 2019-12-09 10:31:33 +01:00
parent 340dbcf730
commit bdd1feef5b
2 changed files with 6 additions and 5 deletions

View File

@ -6722,7 +6722,7 @@ sub qemu_img_convert {
my $cachemode;
my $src_path;
my $src_is_iscsi = 0;
my $src_format = 'raw';
my $src_format;
if ($src_storeid) {
PVE::Storage::activate_volumes($storecfg, [$src_volid], $snapname);
@ -6747,14 +6747,15 @@ sub qemu_img_convert {
my $cmd = [];
push @$cmd, '/usr/bin/qemu-img', 'convert', '-p', '-n';
push @$cmd, '-l', "snapshot.name=$snapname" if($snapname && $src_format eq "qcow2");
push @$cmd, '-l', "snapshot.name=$snapname"
if $snapname && $src_format && $src_format eq "qcow2";
push @$cmd, '-t', 'none' if $dst_scfg->{type} eq 'zfspool';
push @$cmd, '-T', $cachemode if defined($cachemode);
if ($src_is_iscsi) {
push @$cmd, '--image-opts';
$src_path = convert_iscsi_path($src_path);
} else {
} elsif ($src_format) {
push @$cmd, '-f', $src_format;
}

View File

@ -170,7 +170,7 @@ my $tests = [
name => "efidisk",
parameters => [ "/usr/share/kvm/OVMF_VARS-pure-efi.fd", "local:$vmid/vm-$vmid-disk-0.raw", 1024*10, undef, 0 ],
expected => [
"/usr/bin/qemu-img", "convert", "-p", "-n", "-f", "raw", "-O", "raw",
"/usr/bin/qemu-img", "convert", "-p", "-n", "-O", "raw",
"/usr/share/kvm/OVMF_VARS-pure-efi.fd",
"/var/lib/vz/images/$vmid/vm-$vmid-disk-0.raw",
]
@ -179,7 +179,7 @@ my $tests = [
name => "efi2zos",
parameters => [ "/usr/share/kvm/OVMF_VARS-pure-efi.fd", "zfs-over-iscsi:vm-$vmid-disk-0", 1024*10, undef, 0 ],
expected => [
"/usr/bin/qemu-img", "convert", "-p", "-n", "-f", "raw", "--target-image-opts",
"/usr/bin/qemu-img", "convert", "-p", "-n", "--target-image-opts",
"/usr/share/kvm/OVMF_VARS-pure-efi.fd",
"file.driver=iscsi,file.transport=tcp,file.initiator-name=foobar,file.portal=127.0.0.1,file.target=iqn.2019-10.org.test:foobar,file.lun=1,driver=raw",
]