[pve-devel] [PATCH qemu-server 12/15] phase3_cleanup: add finish_spice_migration

Alexandre Derumier aderumier at odiso.com
Mon Apr 29 12:01:27 CEST 2019


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 9ab8039..7529502 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -616,21 +616,9 @@ sub phase3_cleanup {
     move_config($self, $vmid);
 
     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 = PVE::QemuServer::vm_mon_cmd_nocheck($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); };
     if (my $err = $@) {
@@ -1161,4 +1149,23 @@ 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 = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, 'query-spice');
+		last if int($res->{'migrated'}) == 1;
+		last if $timer > 50;
+		$timer ++;
+		usleep(200000);
+	    }
+	}
+    };
+}
 1;
-- 
2.11.0




More information about the pve-devel mailing list