During migration, the volume names may change if the name is already in
use at the target location. We therefore want to save the original names
before the migration so that we can deactivate the original volumes
afterwards.

Signed-off-by: Hannes Duerr <h.du...@proxmox.com>
---
 PVE/QemuMigrate.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index b87e47a..ec4710d 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -744,6 +744,11 @@ sub phase1 {
     $conf->{lock} = 'migrate';
     PVE::QemuConfig->write_config($vmid, $conf);
 
+    PVE::QemuConfig->foreach_volume($conf, sub {
+       my ($ds, $drive) = @_;
+        push $self->{source_volumes}->@*, $drive->{file};
+    });
+
     $self->scan_local_volumes($vmid);
 
     # fix disk sizes to match their actual size and write changes,
@@ -1586,8 +1591,7 @@ sub phase3_cleanup {
 
     # always deactivate volumes - avoid lvm LVs to be active on several nodes
     eval {
-       my $vollist = PVE::QemuServer::get_vm_volumes($conf);
-       PVE::Storage::deactivate_volumes($self->{storecfg}, $vollist);
+       PVE::Storage::deactivate_volumes($self->{storecfg}, 
$self->{source_volumes});
     };
     if (my $err = $@) {
        $self->log('err', $err);
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to