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

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jul 18 14:43:46 CEST 2019


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:
    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 9f29927..72c5d2d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6825,7 +6825,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;
 
@@ -6852,6 +6852,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