[libvirt PATCH] qemu: Pass vm to qemuMigrationCookieParse if it exists

Jiri Denemark jdenemar at redhat.com
Wed Nov 30 14:24:02 UTC 2022


The vm object is used inside qemuMigrationCookieParse based on the flags
passed to qemuMigrationCookieParse and the content of the cookie. The
callers should not just blindly guess and pass NULL if they
(incorrectly) think the vm object is not needed. We should always pass
the vm object unless it does not exist yet.

This fixes a bug when statistics of a completed migration reported
"Unknown" operation instead of "Incoming migration" on the destination
host.

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

Fixes: v8.7.0-79-g0150f7a8c1
Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bef06f4caf..6d3810c79c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4775,7 +4775,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
                                    QEMU_MIGRATION_COOKIE_GRAPHICS |
                                    QEMU_MIGRATION_COOKIE_CAPS |
                                    QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS,
-                                   NULL);
+                                   vm);
     if (!mig)
         goto error;
 
@@ -6459,7 +6459,7 @@ qemuMigrationDstFinishOffline(virQEMUDriver *driver,
     g_autoptr(qemuMigrationCookie) mig = NULL;
 
     if (!(mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv,
-                                         cookiein, cookieinlen, cookie_flags, NULL)))
+                                         cookiein, cookieinlen, cookie_flags, vm)))
         return NULL;
 
     if (qemuMigrationDstPersist(driver, vm, mig, false) < 0)
@@ -6655,7 +6655,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
               vm, flags, retcode);
 
     if (!(mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv,
-                                         cookiein, cookieinlen, cookie_flags, NULL)))
+                                         cookiein, cookieinlen, cookie_flags, vm)))
         goto error;
 
     if (retcode != 0) {
-- 
2.38.1



More information about the libvir-list mailing list