mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-03 08:20:04 +00:00
sync_disks: Always set 'snapshots' for qcow2 and vmdk volumes
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 (instead of just 'dd') 'qemu-img convert', which fails when its output leaves through a pipe. Upon importing, a second error is present, because the format from the volume ID doesn't match the format of the stream and there is no conversion yet. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> LGTM-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
b2d27b3242
commit
5eca0c3643
@ -311,9 +311,14 @@ sub sync_disks {
|
||||
PVE::Storage::storage_check_node($self->{storecfg}, $targetsid, $self->{node});
|
||||
|
||||
PVE::Storage::foreach_volid($dl, sub {
|
||||
my ($volid, $sid, $volname) = @_;
|
||||
my ($volid, $sid, $volinfo) = @_;
|
||||
|
||||
$local_volumes->{$volid}->{ref} = 'storage';
|
||||
|
||||
# If with_snapshots is not set for storage migrate, it tries to use
|
||||
# a raw+size stream, but on-the-fly conversion from qcow2 to raw+size
|
||||
# back to qcow2 is currently not possible.
|
||||
$local_volumes->{$volid}->{snapshots} = ($volinfo->{format} =~ /^(?:qcow2|vmdk)$/);
|
||||
});
|
||||
}
|
||||
|
||||
@ -366,8 +371,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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user