mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-25 00:51:42 +00:00
migration : enable auto-converge capability v2
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@odiso.com>
This commit is contained in:
parent
4623ea3421
commit
a89fded11f
@ -385,13 +385,10 @@ sub phase2 {
|
|||||||
$self->log('info', "migrate_set_downtime error: $@") if $@;
|
$self->log('info', "migrate_set_downtime error: $@") if $@;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $capabilities = {};
|
|
||||||
$capabilities->{capability} = "xbzrle";
|
|
||||||
$capabilities->{state} = JSON::false;
|
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [$capabilities]);
|
PVE::QemuServer::set_migration_caps($vmid);
|
||||||
};
|
};
|
||||||
|
warn $@ if $@;
|
||||||
|
|
||||||
#set cachesize 10% of the total memory
|
#set cachesize 10% of the total memory
|
||||||
my $cachesize = int($conf->{memory}*1048576/10);
|
my $cachesize = int($conf->{memory}*1048576/10);
|
||||||
|
@ -3094,6 +3094,32 @@ sub qga_unfreezefs {
|
|||||||
#need to impplement call to qemu-ga
|
#need to impplement call to qemu-ga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub PVE::QemuServer::set_migration_caps {
|
||||||
|
my ($vmid) = @_;
|
||||||
|
|
||||||
|
my @capabilities = ();
|
||||||
|
my $cap_ref = \@capabilities;
|
||||||
|
|
||||||
|
my $enabled_cap = {
|
||||||
|
"auto-converge" => 1,
|
||||||
|
"xbzrle" => 0,
|
||||||
|
"x-rdma-pin-all" => 0,
|
||||||
|
"zero-blocks" => 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
my $supported_capabilities = PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "query-migrate-capabilities");
|
||||||
|
|
||||||
|
for my $supported_capability (@$supported_capabilities){
|
||||||
|
if($enabled_cap->{$supported_capability->{capability}} eq 1){
|
||||||
|
my $capability->{capability} = $supported_capability->{capability};
|
||||||
|
$capability->{state} = JSON::true;
|
||||||
|
push(@$cap_ref,$capability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => $cap_ref);
|
||||||
|
}
|
||||||
|
|
||||||
sub vm_start {
|
sub vm_start {
|
||||||
my ($storecfg, $vmid, $statefile, $skiplock, $migratedfrom, $paused, $forcemachine, $spice_ticket) = @_;
|
my ($storecfg, $vmid, $statefile, $skiplock, $migratedfrom, $paused, $forcemachine, $spice_ticket) = @_;
|
||||||
|
|
||||||
@ -3160,12 +3186,12 @@ sub vm_start {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($migratedfrom) {
|
if ($migratedfrom) {
|
||||||
my $capabilities = {};
|
|
||||||
$capabilities->{capability} = "xbzrle";
|
eval {
|
||||||
$capabilities->{state} = JSON::true;
|
PVE::QemuServer::set_migration_caps($vmid);
|
||||||
eval { vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => [$capabilities]); };
|
};
|
||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
|
|
||||||
if ($spice_port) {
|
if ($spice_port) {
|
||||||
print "spice listens on port $spice_port\n";
|
print "spice listens on port $spice_port\n";
|
||||||
if ($spice_ticket) {
|
if ($spice_ticket) {
|
||||||
|
Loading…
Reference in New Issue
Block a user