]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuMigrate.pm
migrate: workaround issues with format switch on storage live migration
[qemu-server.git] / PVE / QemuMigrate.pm
index 5ed953add834e76d3680028cf48bc4a803156592..97fd9940e2b2dcf0411796d3d49042ef07be9718 100644 (file)
@@ -557,9 +557,10 @@ sub sync_disks {
                    'allow_rename' => !$local_volumes->{$volid}->{is_vmstate},
                };
 
+               my $logfunc = sub { $self->log('info', $_[0]); };
                my $new_volid = eval {
                    PVE::Storage::storage_migrate($storecfg, $volid, $self->{ssh_info},
-                                                 $targetsid, $storage_migrate_opts);
+                                                 $targetsid, $storage_migrate_opts, $logfunc);
                };
                if (my $err = $@) {
                    die "storage migration for '$volid' to storage '$targetsid' failed - $err\n";
@@ -1142,7 +1143,17 @@ sub phase3_cleanup {
     }
 
     if ($self->{volume_map}) {
+       my $target_drives = $self->{target_drive};
+
+       # FIXME: for NBD storage migration we now only update the volid, and
+       # not the full drivestr from the target node. Workaround that until we
+       # got some real rescan, to avoid things like wrong format in the drive
+       delete $conf->{$_} for keys %$target_drives;
        PVE::QemuConfig->update_volume_ids($conf, $self->{volume_map});
+
+       for my $drive (keys %$target_drives) {
+           $conf->{$drive} = $target_drives->{$drive}->{drivestr};
+       }
        PVE::QemuConfig->write_config($vmid, $conf);
     }