]> git.proxmox.com Git - qemu-server.git/commitdiff
qemu migrate : only wait for spice server online + eval
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 18 Sep 2013 05:45:39 +0000 (07:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 19 Sep 2013 04:28:17 +0000 (06:28 +0200)
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@odiso.com>
PVE/QemuMigrate.pm

index d88180bfa9264666c3587487d4449b5d3c6c83c6..634c305bca07d4f3b67a1430c644de9471504577 100644 (file)
@@ -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); };