[libvirt] [PATCH] Set qemu migration speed unlimited when migrating to file

Eric Blake eblake at redhat.com
Thu Aug 4 16:43:03 UTC 2011


On 08/04/2011 10:22 AM, Jim Fehlig wrote:
> Discussed previously:
>
> https://www.redhat.com/archives/libvir-list/2011-August/msg00166.html
>
> The qemu migration speed default is 32MiB/s as defined in migration.c
>
> /* Migration speed throttling */
> static int64_t max_throttle = (32<<  20);
>
> There is no reason to throttle migration when targeting a file.  For
> dump and save operations, set migration speed to unlimited prior to
> migration and restore to default value after migration.  Default units
> is MB for migrate_set_speed monitor command, so (INT64_MAX / (1024 * 1024))
> is used for unlimited migration speed.
>
> Tested with both json and text monitors.
> ---
>   src/qemu/qemu_migration.c |   12 ++++++++++++
>   1 files changed, 12 insertions(+), 0 deletions(-)

Nice idea, but incomplete patch.

>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 7aeea69..4542289 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2676,6 +2676,13 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
>       virCommandPtr cmd = NULL;
>       int pipeFD[2] = { -1, -1 };
>
> +    /* No need for qemu default of 32MiB/s when migrating to a file.
> +       Default speed unit is MB, so set to unlimited with INT64_MAX / 1M.
> +       Failure to change migration speed is not fatal. */
> +    qemuDomainObjEnterMonitor(driver, vm);
> +    qemuMonitorSetMigrationSpeed(priv->mon, INT64_MAX / (1024 * 1024));
> +    qemuDomainObjExitMonitor(driver, vm);
> +
>       if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)&&

Missing a check that the domain is still active after you exit the 
monitor (in both places).  Furthermore, since migrationToFile is only 
used inside async jobs, we should be using 
qemuDomainObjEnterMonitorAsync, not qemuDomainObjEnterMonitor (fixing 
that will add in the check for a still-active vm, but then you have to 
be careful to only call qemuDomainObjExitMonitorWithDriver if you 
successfully entered the monitor).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list