From bc6c8231648debb2db236e2799053df375c67c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 17 Mar 2020 08:55:25 +0100 Subject: [PATCH] drive-mirror: add support for incremental sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by re-using a dirty bitmap that represents changes since the divergence of source and target volume. requires a qemu that supports incremental drive-mirroring, and will die otherwise. Signed-off-by: Fabian Grünbichler Tested-by: Stefan Reiter --- PVE/QemuServer.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 773e3f06..8b746d98 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -6529,7 +6529,7 @@ sub qemu_img_format { } sub qemu_drive_mirror { - my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $completion, $qga, $bwlimit) = @_; + my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $completion, $qga, $bwlimit, $src_bitmap) = @_; $jobs = {} if !$jobs; @@ -6556,6 +6556,12 @@ sub qemu_drive_mirror { my $opts = { timeout => 10, device => "drive-$drive", mode => "existing", sync => "full", target => $qemu_target }; $opts->{format} = $format if $format; + if (defined($src_bitmap)) { + $opts->{sync} = 'incremental'; + $opts->{bitmap} = $src_bitmap; + print "drive mirror re-using dirty bitmap '$src_bitmap'\n"; + } + if (defined($bwlimit)) { $opts->{speed} = $bwlimit * 1024; print "drive mirror is starting for drive-$drive with bandwidth limit: ${bwlimit} KB/s\n";