]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Pass vm to qemuMigrationCookieParse if it exists
authorJiri Denemark <jdenemar@redhat.com>
Wed, 30 Nov 2022 13:29:55 +0000 (14:29 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 1 Dec 2022 09:30:21 +0000 (10:30 +0100)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_migration.c

index bef06f4caff7a11fcf312f6b75c0cb720995c14e..6d3810c79cc00e839bbfe22be4911639000b5708 100644 (file)
@@ -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) {