[pve-devel] [PATCH v2 qemu-server 14/16] phase3_cleanup: add delete_local_volumes
Alexandre Derumier
aderumier at odiso.com
Mon Mar 9 16:24:37 CET 2020
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 6b14c25..8e22368 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -626,11 +626,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);
@@ -641,20 +638,7 @@ sub phase3_cleanup {
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 ];
@@ -1200,4 +1184,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.20.1
More information about the pve-devel
mailing list