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

Alexandre DERUMIER aderumier at odiso.com
Wed Jan 8 10:18:22 CET 2014


>>sub PVE::QemuServer::set_migration_caps { 
>>my ($vmid) = @_; 
>>
>>my $capability = {}; 
>>my $capability2 = {}; 
>>
>>... 
>>
>>PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", 
>>capabilities => [ $capability, $capability2 ]); 
>>} 

Ok, I'll do like this


>>Does this break migration if VM is started with older KVM? 

I'll test.
I have tested with same qemu version, with source with auto-converge disable and destination with auto-converge enable,it's works fine.
So, I think it should works, but I don't known if qmp will die or not if trying to enable an unavailable capability.
I think the best way could be to test which capability is available for current running qemu version, with qmp query-migrate-capabilities.



----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Mercredi 8 Janvier 2014 06:38:03 
Objet: RE: [pve-devel] [PATCH] migration : enable auto-converge capability 

Hi Alexandre, 

first, sorry for the delay. 

Comments inline: 

> 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; 

We use the same code at two locations, so it is maybe worth to factor out: 

sub get_migrate_caps { 

return [....]; 
} 

or maybe: 

sub PVE::QemuServer::set_migration_caps { 
my ($vmid) = @_; 

my $capability = {}; 
my $capability2 = {}; 

... 

PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", 
capabilities => [ $capability, $capability2 ]); 
} 

> 
> 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 ]); 
> }; 

Does this break migration if VM is started with older KVM? 

> #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 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



More information about the pve-devel mailing list