Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/QemuMigrate.pm | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 1566b82..3aaee51 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -637,19 +637,7 @@ sub phase3_cleanup {
 
     finish_livemigration($self, $vmid);
 
-    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 = mon_cmd($vmid, 'query-spice');
-               last if int($res->{'migrated'}) == 1;
-               last if $timer > 50;
-               $timer ++;
-               usleep(200000);
-           }
-       }
-    };
+    finish_spice_migration($self, $vmid);
 
     # always stop local VM
     eval { PVE::QemuServer::vm_stop($self->{storecfg}, $vmid, 1, 1); };
@@ -1184,4 +1172,24 @@ sub finish_livemigration {
     }
 }
 
+sub finish_spice_migration {
+    my ($self, $vmid) = @_;
+
+    my $conf = $self->{vmconf};
+
+    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 = mon_cmd($vmid, 'query-spice');
+               last if int($res->{'migrated'}) == 1;
+               last if $timer > 50;
+               $timer ++;
+               usleep(200000);
+           }
+       }
+    };
+}
+
 1;
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to