]> git.proxmox.com Git - qemu-server.git/commitdiff
bwlimit: add parameter to qemu_drive_mirror
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 1 Apr 2019 09:30:59 +0000 (11:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 2 Apr 2019 08:34:40 +0000 (10:34 +0200)
used for online drive migrations, move_disk and clone calls.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE/QemuServer.pm

index fd854c4e1a984897b79f7e062773ead17bb9b97a..f9b0f58cd0cc36a489e581fc37ec4c4b90fd58ec 100644 (file)
@@ -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); };