[libvirt] [PATCH] migration: convert speed from Mb/sec to bytes/sec in drive-mirror jobs

Ján Tomko jtomko at redhat.com
Thu Mar 31 17:30:23 UTC 2016


On Mon, Mar 28, 2016 at 12:02:09PM +0800, Rudy Zhang wrote:
> Block migration speed is differect from memory migration speed, because
> it not convert speed from Mb/sec to bytes/sec in the drive-mirror job.
> 

It might be worth noting that this was introduced by commit 08cc14f [1],
released in libvirt 1.2.9, which removed the conversion from
qemuMonitorDriveMirror but did not adjust all the callers.

> Signed-off-by: Rudy Zhang <rudyflyzhang at gmail.com>
> ---
>  src/qemu/qemu_migration.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 8bc76bf..7648d8c 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2135,8 +2135,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
>  
>          qemuBlockJobSyncBegin(disk);
>          /* Force "raw" format for NBD export */
> -        mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,
> -                                         "raw", speed, 0, 0, mirror_flags);
> +        mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,"raw",
> +                        (unsigned long long)speed << 20, 0, 0, mirror_flags);

This could overflow if sizeof(unsigned long) == sizeof(unsigned long
long), but we don't seem to mind taking the bandwith passed by
virTypedParams in an unsigned long long type and passing it to
qemuMigrationRun as unsigned long.


This comment of qemuMigrationDriveMirror:

 * @speed: how much should the copying be limited

could also be ajdusted to include the units.


I would push the patch but I do not have the time to try it out now.

Jan

[1] http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=08cc14f




More information about the libvir-list mailing list