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(a)redhat.com>
---
src/qemu/qemu_migration.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dd226ea4bc..71edcd5c62 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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;
--
2.31.1