On Mon, Sep 30, 2024 at 03:29:34PM +0200, Peter Krempa wrote: > The new 'VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES' migration > parameter allows users of migration to pass in a list of disks where > zero-detection (which avoids transferring the zeroed-blocks) should be > enabled for the migration connection. This comes at the cost of extra > CPU cycles needed to check each block if it's all-zero. > > This is useful for storage backends where information about the > allocation state of a block is not available and thus without this the > image would become fully allocated on the destination. > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > include/libvirt/libvirt-domain.h | 13 ++++ > src/qemu/qemu_driver.c | 20 ++++-- > src/qemu/qemu_migration.c | 105 +++++++++++++++++++++++-------- > src/qemu/qemu_migration.h | 4 ++ > 4 files changed, 110 insertions(+), 32 deletions(-) > > diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h > index 4266237abe..6d4cc69c5d 100644 > --- a/include/libvirt/libvirt-domain.h > +++ b/include/libvirt/libvirt-domain.h > @@ -1240,6 +1240,19 @@ typedef enum { > */ > # define VIR_MIGRATE_PARAM_MIGRATE_DISKS "migrate_disks" > > +/** > + * VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES: > + * > + * 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 > + * moment this is only supported by the QEMU driver but not for the tunnelled > + * migration. We should note that it has to be subset of migrate_disks values. I also wonder if we should add a code that will error out if it's not the case, currently it would be silently ignored. > + * > + * Since: 10.9.0 > + */ > +# define VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES "migrate_disks_detect_zeroes" > + > /** > * VIR_MIGRATE_PARAM_DISKS_PORT: > * [...] > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index 94636e778d..7ae19dd0ce 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -5316,9 +5348,11 @@ qemuMigrationSrcPerformTunnel(virQEMUDriver *driver, > goto cleanup; > } > > + /* Migration with NBD is not supported with _TUNNELED, thus s/_TUNNELED/_TUNNELLED/ To match the incorrect spelling of the actual flag. > + * 'migrate_disks_detect_zeroes' is NULL here */ > ret = qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookiein, cookieinlen, > cookieout, cookieoutlen, flags, resource, &spec, > - dconn, graphicsuri, migrate_disks, > + dconn, graphicsuri, migrate_disks, NULL, > migParams, NULL); > > cleanup: Pavel
Attachment:
signature.asc
Description: PGP signature