1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu_migration: set bandwidth in priv during migration

We did not set priv->migMaxBandwidth if '--bandwidth' was
specified as an option in the 'migrate' virsh command. This
caused in printing the wrong value if virsh command
'migrate-getspeed' was called during the migration. This patch
first sets the value to the given bandwidth (if one was
specified) and restores the previous value after the migration.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1806856

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Kristina Hanicova 2021-10-08 10:19:04 +02:00 committed by Michal Privoznik
parent 926864ba45
commit 8c26fd7823

View File

@ -4013,6 +4013,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
qemuMigrationIOThread *iothread = NULL;
VIR_AUTOCLOSE fd = -1;
unsigned long migrate_speed = resource ? resource : priv->migMaxBandwidth;
unsigned long restore_max_bandwidth = priv->migMaxBandwidth;
virErrorPtr orig_err = NULL;
unsigned int cookieFlags = 0;
bool abort_on_error = !!(flags & VIR_MIGRATE_ABORT_ON_ERROR);
@ -4025,6 +4026,8 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
g_autofree char *timestamp = NULL;
int rc;
priv->migMaxBandwidth = migrate_speed;
VIR_DEBUG("driver=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, flags=0x%lx, resource=%lu, "
"spec=%p (dest=%d, fwd=%d), dconn=%p, graphicsuri=%s, "
@ -4351,6 +4354,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
if (events)
priv->signalIOError = false;
priv->migMaxBandwidth = restore_max_bandwidth;
virErrorRestore(&orig_err);
return ret;