]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuMigrationDstPrepareAnyBlockDirtyBitmaps: Always consider offered bitmaps
authorPeter Krempa <pkrempa@redhat.com>
Tue, 27 Jan 2026 16:28:48 +0000 (17:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Feb 2026 14:34:52 +0000 (15:34 +0100)
commitbf34b90bb4e39b3a2fd22a5531f5ea5a95681015
tree991a82d5b01eee3649009c370623fda1771dd4aa
parenta4f610ff3fe190058f18baea18b095d0bc69441b
qemuMigrationDstPrepareAnyBlockDirtyBitmaps: Always consider offered bitmaps

Consider bitmaps for incoming migration regardless of non-shared storage
flag.

When bitmaps are offered from the source, consult the local image if the
bitmap is present and if not accept migration. Migration of bitmaps
which exist in the qcow2 metadata is skipped because qemu rejects such
setup (although handles it correctly in case of shared storage setup;
see below).

This allows bitmap propagation for cases when the qcow2 image is not
actually shared between destinations but the data is (using the
data_file feature).

At the same time this preserves existing bitmap handling semantics for
other cases. Specifically qemu, in case of shared storage properly
propagates the bitmap which was already recorded in the qcow2 metadata
on disk even if libvirt doesn't instruct migration, yet tolerates
migration instruction if the file is not yet recorded in the on-disk
metadata. In both cases the contents are preserved correctly.

When storage is not shared (which includes even cases when we migrate
it via NBD) it's expected that the bitmaps don't exist on the
destination and thus all will be picked for migration. We can also
infer that this wasn't ever a problem by the fact that the code skipping
migration of existing bitmaps was broken until recently, and qemu
would refuse such config.

I've tested all the above scenarios including verifying that the
resulting bitmaps capture dirtied regions before and after migration.
For testing this the following command is useful:

  virsh qemu-monitor-command --domain DOMNAME --hmp 'qemu-io -d /machine/peripheral/virtio-disk0/virtio-backend "write -P 0xcc 4M 1M"'

Which simulates a write from the guest side without the need to interact
with the guest OS.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_migration.c