[PATCH] mark mig->flags as QEMU_MIGRATION_COOKIE_GRAPHICS only when mig->graphics is not NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steps to reproduce this problem:
1. remove all <graphics ...> from xml.
2. start the domain
3. migrate the domain to another host, and libvirtd on the target host
   will crash.

The reason of this bug is that we mark mig->flags as QEMU_MIGRATION_COOKIE_GRAPHICS
even if we have no graphics. We will use mig->graphics when mig->flgas is
QEMU_MIGRATION_COOKIE_GRAPHICS in the function qemuMigrationCookieXMLFormat()

---
 src/qemu/qemu_migration.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index cb408ac..3def14b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -252,11 +252,13 @@ qemuMigrationCookieAddGraphics(qemuMigrationCookiePtr mig,
 
     if (dom->def->ngraphics == 1 &&
         (dom->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
-         dom->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) &&
-        !(mig->graphics = qemuMigrationCookieGraphicsAlloc(driver, dom->def->graphics[0])))
-        return -1;
-
-    mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
+         dom->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE)) {
+        mig->graphics = qemuMigrationCookieGraphicsAlloc(driver,
+                                                         dom->def->graphics[0]);
+        if (mig->graphics == NULL)
+            return -1;
+        mig->flags |= QEMU_MIGRATION_COOKIE_GRAPHICS;
+    }
 
     return 0;
 }
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]