[pve-devel] [PATCH qemu-server v2 2/8] bwlimit: add parameter to qemu_drive_mirror

Stoiko Ivanov s.ivanov at proxmox.com
Mon Apr 1 11:30:59 CEST 2019


used for online drive migrations, move_disk and clone calls.

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fd854c4..f9b0f58 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6728,7 +6728,7 @@ sub qemu_img_format {
 }
 
 sub qemu_drive_mirror {
-    my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $skipcomplete, $qga) = @_;
+    my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $skipcomplete, $qga, $bwlimit) = @_;
 
     $jobs = {} if !$jobs;
 
@@ -6755,7 +6755,12 @@ sub qemu_drive_mirror {
     my $opts = { timeout => 10, device => "drive-$drive", mode => "existing", sync => "full", target => $qemu_target };
     $opts->{format} = $format if $format;
 
-    print "drive mirror is starting for drive-$drive\n";
+    if (defined($bwlimit)) {
+	my $bwlimit_bps = $opts->{speed} = $bwlimit * 1024;
+	print "drive mirror is starting for drive-$drive with bandwidth limit: ${bwlimit}KB/s\n";
+    } else {
+	print "drive mirror is starting for drive-$drive\n";
+    }
 
     # if a job already runs for this device we get an error, catch it for cleanup
     eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); };
-- 
2.11.0





More information about the pve-devel mailing list