[pve-devel] [PATCH container v2 1/3] bwlimit: add parameter to LXC::Migrate

Stoiko Ivanov s.ivanov at proxmox.com
Mon Apr 1 11:31:06 CEST 2019


pass bwlimit parameter to storage_migrate

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PVE/LXC/Migrate.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index 1364b8d..7df3c4c 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -277,13 +277,18 @@ sub phase1 {
 	    'PVE::LXC::Config', $jobcfg, $start_time, $start_time, $logfunc);
     }
 
-    my $insecure = $self->{opts}->{migration_type} eq 'insecure';
+    my $opts = $self->{opts};
+    my $insecure = $opts->{migration_type} eq 'insecure';
     foreach my $volid (keys %$volhash) {
 	next if $rep_volumes->{$volid};
 	my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
 	push @{$self->{volumes}}, $volid;
 	my $with_snapshots = $volhash->{$volid}->{snapshots};
-	PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, undef, undef, undef, undef, $insecure, $with_snapshots);
+	my $bwlimit = PVE::Storage::get_bandwidth_limit('migrate', [$sid], $opts->{bwlimit});
+	# JSONSchema and get_bandwidth_limit use kbps - storage_migrate bps
+	$bwlimit = $bwlimit * 1024 if defined($bwlimit);
+
+	PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, undef, undef, undef, $bwlimit, $insecure, $with_snapshots);
     }
 
     my $conffile = PVE::LXC::Config->config_file($vmid);
-- 
2.11.0





More information about the pve-devel mailing list