[PATCH 0/2] qemu: mention caveat with zero detection during migration and add NEWS

Peter Krempa (2): docs: Add warning about using a cleared image with VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES_ZEROES NEWS: mention zero detection for non-shared-storage migration NEWS.rst | 11 +++++++++++ docs/manpages/virsh.rst | 4 +++- include/libvirt/libvirt-domain.h | 5 ++++- 3 files changed, 18 insertions(+), 2 deletions(-) -- 2.47.0

The migration parameter causes zero detection to be enabled and zero blocks are *not* transferred to the destination. This means that users must provide pre-cleared images that read all zero, otherwise the non-zero blocks on destination which reside in places where the source has zero blocks would be kept intact corrupting the image. As not transferring and overwriting the zero blocks is what the feature is supposed to do the users need to provide the proper environment. Document the requirement, both in API and in the virsh man page for the '--migrate-disks-detect-zeroes' option. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- docs/manpages/virsh.rst | 4 +++- include/libvirt/libvirt-domain.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 6665d46497..6776ea53d0 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3425,7 +3425,9 @@ transfer via the comma separated ``disk-list`` argument. The *--migrate-disks-detect-zeroes* option which takes a comma separated list of disk target names enables zeroed block detection for the listed migrated disks. These blocks are not transferred or allocated on destination, effectively -sparsifying the disk at the cost of CPU overhead. +sparsifying the disk at the cost of CPU overhead. Users must ensure that any +pre-created storage source is cleared and thus reads all-zeroes before using +this option as otherwise the destination image may become corrupted. With *--copy-storage-synchronous-writes* flag used the disk data migration will synchronously handle guest disk writes to both the original source and the destination to ensure that the disk migration converges at the price of possibly diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 6d4cc69c5d..9232ce2e6b 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1245,7 +1245,10 @@ typedef enum { * * virDomainMigrate* params multiple field: The multiple values that list * the block devices for which zero detection (to avoid transferring zero blocks) - * is to be enabled. This may increase CPU overhead of the migration. At the + * is to be enabled. Users must ensure that any pre-created storage source on + * the destination will be cleared and thus read all-zeroes before using this + * feature, otherwise the destination image may become corrupted. + * This may increase CPU overhead of the migration. At the * moment this is only supported by the QEMU driver but not for the tunnelled * migration. * -- 2.47.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- NEWS.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 7f4f33c8f8..7a4a0e1d1f 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,17 @@ v10.9.0 (unreleased) * **New features** + * qemu: zero block detection for non-shared-storage migration + + Users can now request that all-zero blocks are not transferred when migrating + non-shared disk data without actually enabling zero detection on the disk + itself. This allows sparsifying images during migration where the source + has no access to the allocation state of blocks at the cost of CPU overhead. + + This feature is avaliable via the ``--migrate-disks-detect-zeroes`` option + for ``virsh migrate`` or ``VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES_ZEROES`` + migration parameter. See the documentation for caveats. + * **Improvements** * qemu: internal snapshot improvements -- 2.47.0

On a Thursday in 2024, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- NEWS.rst | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst index 7f4f33c8f8..7a4a0e1d1f 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,17 @@ v10.9.0 (unreleased)
* **New features**
+ * qemu: zero block detection for non-shared-storage migration + + Users can now request that all-zero blocks are not transferred when migrating + non-shared disk data without actually enabling zero detection on the disk + itself. This allows sparsifying images during migration where the source + has no access to the allocation state of blocks at the cost of CPU overhead. + + This feature is avaliable via the ``--migrate-disks-detect-zeroes`` option
*available Jano
+ for ``virsh migrate`` or ``VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES_ZEROES`` + migration parameter. See the documentation for caveats. + * **Improvements**
* qemu: internal snapshot improvements -- 2.47.0

On Thu, Oct 10, 2024 at 10:38:42 +0200, Peter Krempa wrote:
Peter Krempa (2): docs: Add warning about using a cleared image with VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES_ZEROES NEWS: mention zero detection for non-shared-storage migration
NEWS.rst | 11 +++++++++++ docs/manpages/virsh.rst | 4 +++- include/libvirt/libvirt-domain.h | 5 ++++- 3 files changed, 18 insertions(+), 2 deletions(-)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
participants (3)
-
Jiri Denemark
-
Ján Tomko
-
Peter Krempa