[pve-devel] [PATCH v2 qemu-server 1/3] drive-mirror: add support for incremental sync

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 17 08:55:25 CET 2020


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 <f.gruenbichler at proxmox.com>
---

Notes:
    v1-v2:
    - use newer Qemu patches picked up by me and submitted upstream
    
    this requires a patched qemu, so we might want to check for that in the
    migration code?
    
    it is only required on the source node (where we can just use a
    versioned-dependency from qemu-server to pve-qemu-kvm), but maybe we want to
    avoid migrating from patched nodes to unpatched nodes, since the VM is then
    stuck there and can only be migrated offline/after an upgrade of the host and
    cold reboot of the VM..

 PVE/QemuServer.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b2ff515..83033df 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6521,7 +6521,7 @@ sub qemu_img_format {
 }
 
 sub qemu_drive_mirror {
-    my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $skipcomplete, $qga, $bwlimit) = @_;
+    my ($vmid, $drive, $dst_volid, $vmiddst, $is_zero_initialized, $jobs, $skipcomplete, $qga, $bwlimit, $src_bitmap) = @_;
 
     $jobs = {} if !$jobs;
 
@@ -6548,6 +6548,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";
-- 
2.20.1





More information about the pve-devel mailing list