[pve-devel] [PATCH qemu-server 14/15] phase3_cleanup: add delete_local_volumes

Alexandre Derumier aderumier at odiso.com
Mon Apr 29 12:01:29 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuMigrate.pm | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 4b521fd..6dd97e3 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -606,11 +606,8 @@ sub phase3 {
 sub phase3_cleanup {
     my ($self, $vmid, $err) = @_;
 
-    my $conf = $self->{vmconf};
     return if $self->{phase2errors};
 
-    my $tunnel = $self->{tunnel};
-
 	finish_block_jobs($self, $vmid);
 
     move_config($self, $vmid);
@@ -620,21 +617,8 @@ sub phase3_cleanup {
     finish_spice_migration($self, $vmid);
 
     stop_local_vm($self, $vmid);
-        
-    if($self->{storage_migration}) {
-	# destroy local copies
-	my $volids = $self->{online_local_volumes};
 
-	foreach my $volid (@$volids) {
-	    eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
-	    if (my $err = $@) {
-		$self->log('err', "removing local copy of '$volid' failed - $err");
-		$self->{errors} = 1;
-		last if $err =~ /^interrupted by signal$/;
-	    }
-	}
-
-    }
+    delete_local_volumes($self);
 
     # clear migrate lock
     my $cmd = [ @{$self->{rem_ssh}}, 'qm', 'unlock', $vmid ];
@@ -1177,4 +1161,22 @@ sub stop_local_vm {
     }
 }
 
+sub delete_local_volumes {
+    my ($self) = @_;
+
+    if($self->{storage_migration}) {
+	# destroy local copies
+	my $volids = $self->{online_local_volumes};
+
+	foreach my $volid (@$volids) {
+	    eval { PVE::Storage::vdisk_free($self->{storecfg}, $volid); };
+	    if (my $err = $@) {
+		$self->log('err', "removing local copy of '$volid' failed - $err");
+		$self->{errors} = 1;
+		last if $err =~ /^interrupted by signal$/;
+	    }
+	}
+    }
+}
+
 1;
-- 
2.11.0




More information about the pve-devel mailing list