[pve-devel] [PATCH] qemu migrate : only wait for spice server online + eval

Alexandre Derumier aderumier at odiso.com
Wed Sep 18 07:45:39 CEST 2013


Currently offline migration fail ,because we are trying to check with qmp the spiceserver status.
This should be done online only.

I also add eval, to avoid migration lock if qmp query fail.

Fix :http://forum.proxmox.com/threads/16093-VM-is-locked-after-offline-migration?p=82852

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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index d88180b..634c305 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -590,17 +590,20 @@ sub phase3_cleanup {
 	}
     }
 
-    my $timer = 0;
-    if (PVE::QemuServer::vga_conf_has_spice($conf->{vga})) {
-        $self->log('info', "Waiting for spice server migration");
-	while (1) {
-	    my $res = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, 'query-spice');
-	    last if int($res->{'migrated'}) == 1;
-	    last if $timer > 50;
-	    $timer ++;
-	    usleep(200000);
-        }
-    }
+    eval {
+
+	my $timer = 0;
+	if (PVE::QemuServer::vga_conf_has_spice($conf->{vga}) && $self->{running}) {
+	    $self->log('info', "Waiting for spice server migration");
+	    while (1) {
+		my $res = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, 'query-spice');
+		last if int($res->{'migrated'}) == 1;
+		last if $timer > 50;
+		$timer ++;
+		usleep(200000);
+ 	    }
+	}
+    };
 
     # always stop local VM
     eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); };
-- 
1.7.10.4




More information about the pve-devel mailing list