On January 8, 2020 11:28 am, Fabian Ebner wrote: > This fixes an issue when migrating a VM with an unused volume with format > qcow2 or vmdk. Since 'snapshots' wasn't set, 'storage_migrate' wanted to > export/import with format 'raw+size' instead. Therefore it used > 'qemu-img convert', which fails when its output leaves through a pipe. Upon > importing a second error was present, since the volid didn't match the format. > > Signed-off-by: Fabian Ebner <f.eb...@proxmox.com> > --- > > Here is the error messages: > 2020-01-08 10:34:47 found local disk 'myzfsdir:111/vm-111-disk-0.vmdk' (via > storage) > 2020-01-08 10:34:47 copying local disk images > qemu-img: /dev/stdout: error while converting raw: Could not resize file: > Invalid argument > command 'qemu-img convert -f vmdk -O raw > /myzpool/myzfsdir/images/111/vm-111-disk-0.vmdk /dev/stdout' failed: exit > code 1 > cannot import format raw+size into a file of format vmdk > send/receive failed, cleaning up snapshot(s).. > > PVE/QemuMigrate.pm | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm > index 1de1540..a1e2dea 100644 > --- a/PVE/QemuMigrate.pm > +++ b/PVE/QemuMigrate.pm > @@ -316,6 +316,9 @@ sub sync_disks { > my ($volid, $sid, $volinfo) = @_; > > $local_volumes->{$volid}->{ref} = 'storage'; > + > + # always set 'snapshots' for qcow2 and vmdk volumes
this comment could benefit from a reason why ;) as per our discussion today: storage_migrate does not (yet ;)) support generating raw+size streams from qcow2/vmdk images, and only generates a qcow2/vmdk+size stream if told to include snapshots. > + $local_volumes->{$volid}->{snapshots} = ($volinfo->{format} =~ > /^(?:qcow2|vmdk)$/); > }); > } > > @@ -370,8 +373,9 @@ sub sync_disks { > if !$owner || ($owner != $self->{vmid}); > > my $format = PVE::QemuServer::qemu_img_format($scfg, $volname); > - $local_volumes->{$volid}->{snapshots} = defined($snaprefs) || > ($format =~ /^(?:qcow2|vmdk)$/); > if (defined($snaprefs)) { > + $local_volumes->{$volid}->{snapshots} = 1; > + > # we cannot migrate shapshots on local storage > # exceptions: 'zfspool' or 'qcow2' files (on directory storage) > > -- > 2.20.1 > > > _______________________________________________ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel