]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuServer.pm
fix #2469: fix qemu-img convert src_format detection
[qemu-server.git] / PVE / QemuServer.pm
index 0d0e6108914e73bf059ffe0ad406302cc4ace3c2..76146ca22f43d5ae31e60d9aa77d02d53f8625cd 100644 (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;
     }