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

Stoiko Ivanov s.ivanov at proxmox.com
Fri Mar 29 08:28:01 CET 2019


used for online drive migrations, move_disk and clone calls.

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e60aa28..b8e96ed 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,13 @@ 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 = $bwlimit*1024;
+	$opts->{speed} = $bwlimit_bps;
+	print "drive mirror is starting for drive-$drive with speed: $bwlimit_bps bytes/sec\n";
+    } else {
+	print "drive mirror is starting for drive-$drive\n";
+    }
 
     eval { vm_mon_cmd($vmid, "drive-mirror", %$opts); }; #if a job already run for this device,it's throw an error
 
-- 
2.11.0





More information about the pve-devel mailing list