[pve-devel] [PATCH qemu-server 1/7] bwlimit: honor bwlimit for migrate qmp call

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Mar 29 10:08:19 CET 2019


On 3/29/19 8:28 AM, Stoiko Ivanov wrote:
> The 'migrate_speed' can be set in the VM config. Additionally migrate should
> honor the 'migrate' bwlimit set in datacenter.cfg (storage-specific limits play
> no role for memory+state migration) or the parameter provided to the API call.
> 
> With this patch a set bwlimit overrides the 'migrate_speed' setting.

would it make sense to not plain overwrite it but use the smaller one of both?
Or is this the same behavior as elsewhere? I just want to ensure this is documented,
and seen as expected behavior for users.

> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>  PVE/QemuMigrate.pm | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index ee605d8..8f4ee5b 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -663,9 +663,11 @@ sub phase2 {
>  
>      # always set migrate speed (overwrite kvm default of 32m)
>      # we set a very hight default of 8192m which is basically unlimited
> -    my $migrate_speed = $defaults->{migrate_speed} || 8192;
> -    $migrate_speed = $conf->{migrate_speed} || $migrate_speed;
> -    $migrate_speed = $migrate_speed * 1048576;
> +    my $migrate_speed = $conf->{migrate_speed} // ($defaults->{migrate_speed} || 8192*1024);
> +    #optionally override with $opt_bwlimit - with undef as storagelist
> +    my $bwlimit = PVE::Storage::get_bandwidth_limit('migrate', undef, $opt_bwlimit);
> +    $migrate_speed = $bwlimit // $migrate_speed;
> +    $migrate_speed *= 1024;
>      $self->log('info', "migrate_set_speed: $migrate_speed");
>      eval {
>          PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_speed", value => int($migrate_speed));
> 





More information about the pve-devel mailing list