[pve-devel] [PATCH v2 qemu-server pve-storage 1/2] migration: secure and use source volume names for cleanup

Hannes Duerr h.duerr at proxmox.com
Thu Dec 7 10:12:02 CET 2023


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 clean up the original volumes
afterwards.

Signed-off-by: Hannes Duerr <h.duerr at proxmox.com>
---
 PVE/QemuMigrate.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index b87e47a..6c9e762 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -632,6 +632,7 @@ sub sync_offline_local_volumes {
 
     my $local_volumes = $self->{local_volumes};
     my @volids = $self->filter_local_volumes('offline', 0);
+    $self->{source_volumes} = \@volids;
 
     my $storecfg = $self->{storecfg};
     my $opts = $self->{opts};
@@ -1584,10 +1585,10 @@ sub phase3_cleanup {
 	$self->{errors} = 1;
     }
 
+
     # 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





More information about the pve-devel mailing list