[pve-devel] [PATCH qemu-server 4/7] bwlimit: add parameter for QemuMigrate:phase2

Thomas Lamprecht t.lamprecht at proxmox.com
Sat Mar 30 10:25:29 CET 2019


On 3/29/19 8:28 AM, Stoiko Ivanov wrote:
> used for online local disks via qemu_drive_mirror
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>  PVE/QemuMigrate.pm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 740c673..28b5f43 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -645,6 +645,8 @@ sub phase2 {
>  
>      my $start = time();
>  
> +    my $opt_bwlimit = $self->{opts}->{bwlimit};
> +
>      if (defined($self->{online_local_volumes})) {
>  	$self->{storage_migration} = 1;
>  	$self->{storage_migration_jobs} = {};
> @@ -654,8 +656,12 @@ sub phase2 {
>  	    if (scalar(keys %{$self->{target_drive}}) != scalar @{$self->{online_local_volumes}});
>  	foreach my $drive (keys %{$self->{target_drive}}){

add something like:
my $target = $self->{target_drive}->{$drive};

here and use it for getting $nbd_uri and the new target sid.
looks OK besides that

>  	    my $nbd_uri = $self->{target_drive}->{$drive}->{nbd_uri};
> +	    my $src_sid = PVE::Storage::Plugin::parse_volume_id($conf->{$drive});
> +	    my $tgt_sid = PVE::Storage::Plugin::parse_volume_id($self->{target_drive}->{$drive}->{volid});



nit: I'd write our "source" and "target", while "src" is common known "tgt" isn't.

> +	    my $bwlimit = PVE::Storage::get_bandwidth_limit('migrate', [$src_sid, $tgt_sid], $opt_bwlimit);
> +
>  	    $self->log('info', "$drive: start migration to $nbd_uri");
> -	    PVE::QemuServer::qemu_drive_mirror($vmid, $drive, $nbd_uri, $vmid, undef, $self->{storage_migration_jobs}, 1);
> +	    PVE::QemuServer::qemu_drive_mirror($vmid, $drive, $nbd_uri, $vmid, undef, $self->{storage_migration_jobs}, 1, undef, $bwlimit);
>  	}
>      }
>  
> 




More information about the pve-devel mailing list