[pve-devel] [PATCH] migration : enable auto-converge capability

Alexandre Derumier aderumier at odiso.com
Thu Jan 2 11:57:51 CET 2014


This reduce guest cpu speed if dirtied bytes is 50% more than the approx.amount of bytes that just got transferred since the last time we were in this routine.

qemu commit :
http://git.qemu.org/?p=qemu.git;a=commit;h=bde1e2ec2176c363c1783bf8887b6b1beb08dfee

tested with "stress -m 2 -c 2" under debian

without autoconvergence : downtime 12s - duration 12min
with autoconvergence : downtime 2s - duration 4min

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuMigrate.pm |   12 ++++++++----
 PVE/QemuServer.pm  |   15 +++++++++++----
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index d980f0b..a6c0ada 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -385,12 +385,16 @@ sub phase2 {
 	$self->log('info', "migrate_set_downtime error: $@") if $@;
     }
 
-    my $capabilities = {};
-    $capabilities->{capability} =  "xbzrle";
-    $capabilities->{state} = JSON::false;
+    my $capability = {};
+    my $capability2 = {};
+
+    $capability->{capability} =  "xbzrle";
+    $capability->{state} = JSON::false;
+    $capability2->{capability} =  "auto-converge";
+    $capability2->{state} = JSON::true;
 
     eval {
-	PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [$capabilities]);
+	PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [ $capability, $capability2 ]);
     };
 
     #set cachesize 10% of the total memory
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index a5576a6..ffad5f2 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3160,10 +3160,17 @@ sub vm_start {
 	}
 
 	if ($migratedfrom) {
-	    my $capabilities = {};
-	    $capabilities->{capability} =  "xbzrle";
-	    $capabilities->{state} = JSON::true;
-	    eval { vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [$capabilities]); };
+	    my $capability = {};
+	    my $capability2 = {};
+
+	    $capability->{capability} =  "xbzrle";
+	    $capability->{state} = JSON::false;
+	    $capability2->{capability} =  "auto-converge";
+	    $capability2->{state} = JSON::true;
+
+	    eval {
+	        PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [ $capability, $capability2 ]);
+	    };
 	    warn $@ if $@;
 	    
 	    if ($spice_port) {
-- 
1.7.10.4




More information about the pve-devel mailing list