[pve-devel] [PATCH qemu-server 06/15] phase2_cleanup : add cancel_migrate
Alexandre Derumier
aderumier at odiso.com
Mon Apr 29 12:01:21 CEST 2019
Also move block job cancel here, before release the lock.
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuMigrate.pm | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 2bca615..ac2da62 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -562,12 +562,8 @@ sub phase2_cleanup {
$self->log('info', "aborting phase 2 - cleanup resources");
- $self->log('info', "migrate_cancel");
- eval {
- PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_cancel");
- };
- $self->log('info', "migrate_cancel error: $@") if $@;
-
+ cancel_migrate($self, $vmid);
+
my $conf = $self->{vmconf};
delete $conf->{lock};
eval { PVE::QemuConfig->write_config($vmid, $conf) };
@@ -578,11 +574,6 @@ sub phase2_cleanup {
# cleanup ressources on target host
if ($self->{storage_migration}) {
- eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $self->{storage_migration_jobs}) };
- if (my $err = $@) {
- $self->log('err', $err);
- }
-
eval { PVE::QemuMigrate::cleanup_remotedisks($self) };
if (my $err = $@) {
$self->log('err', $err);
@@ -1114,4 +1105,24 @@ sub livemigrate {
}
}
+sub cancel_migrate {
+ my ($self, $vmid) = @_;
+
+ $self->log('info', "migrate_cancel");
+ eval {
+ PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_cancel");
+ };
+ $self->log('info', "migrate_cancel error: $@") if $@;
+
+ # cleanup ressources on target host
+ if ($self->{storage_migration}) {
+
+ eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $self->{storage_migration_jobs}) };
+ if (my $err = $@) {
+ $self->log('err', $err);
+ }
+
+ }
+}
+
1;
--
2.11.0
More information about the pve-devel
mailing list