7b4659
From 2178a6fc22688ff6c6464593823f11ead8cbe981 Mon Sep 17 00:00:00 2001
7b4659
Message-Id: <2178a6fc22688ff6c6464593823f11ead8cbe981@dist-git>
7b4659
From: Jiri Denemark <jdenemar@redhat.com>
7b4659
Date: Fri, 16 Aug 2019 14:52:32 +0200
7b4659
Subject: [PATCH] qemu: Pass qemuCaps to qemuMigrationCookieXMLParse
7b4659
MIME-Version: 1.0
7b4659
Content-Type: text/plain; charset=UTF-8
7b4659
Content-Transfer-Encoding: 8bit
7b4659
7b4659
Since qemuDomainDefPostParse callback requires qemuCaps, we need to make
7b4659
sure it gets the capabilities stored in the domain's private data if the
7b4659
domain is running. Passing NULL may cause QEMU capabilities probing to
7b4659
be triggered in case QEMU binary changed in the meantime. When this
7b4659
happens while a running domain object is locked, QMP event delivered to
7b4659
the domain before QEMU capabilities probing finishes will deadlock the
7b4659
event loop.
7b4659
7b4659
This patch fixes all paths leading to qemuMigrationCookieXMLParse.
7b4659
7b4659
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7b4659
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7b4659
(cherry picked from commit bf15b145ec473c0ca5bfe8aee2bf0eb1691b6f1c)
7b4659
7b4659
https://bugzilla.redhat.com/show_bug.cgi?id=1731783
7b4659
https://bugzilla.redhat.com/show_bug.cgi?id=1742023
7b4659
7b4659
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7b4659
Message-Id: <bb8b9769eaec4dcbbaef5e5acc84d1a28d6e82a0.1565959866.git.jdenemar@redhat.com>
7b4659
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7b4659
---
7b4659
 src/qemu/qemu_migration_cookie.c | 7 +++++--
7b4659
 1 file changed, 5 insertions(+), 2 deletions(-)
7b4659
7b4659
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
7b4659
index 901b1ae9ac..b9933b9e04 100644
7b4659
--- a/src/qemu/qemu_migration_cookie.c
7b4659
+++ b/src/qemu/qemu_migration_cookie.c
7b4659
@@ -1194,6 +1194,7 @@ qemuMigrationCookieCapsXMLParse(xmlXPathContextPtr ctxt)
7b4659
 static int
7b4659
 qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
7b4659
                             virQEMUDriverPtr driver,
7b4659
+                            virQEMUCapsPtr qemuCaps,
7b4659
                             xmlDocPtr doc,
7b4659
                             xmlXPathContextPtr ctxt,
7b4659
                             unsigned int flags)
7b4659
@@ -1335,7 +1336,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
7b4659
             goto error;
7b4659
         }
7b4659
         mig->persistent = virDomainDefParseNode(doc, nodes[0],
7b4659
-                                                caps, driver->xmlopt, NULL,
7b4659
+                                                caps, driver->xmlopt, qemuCaps,
7b4659
                                                 VIR_DOMAIN_DEF_PARSE_INACTIVE |
7b4659
                                                 VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION |
7b4659
                                                 VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE);
7b4659
@@ -1388,6 +1389,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
7b4659
 static int
7b4659
 qemuMigrationCookieXMLParseStr(qemuMigrationCookiePtr mig,
7b4659
                                virQEMUDriverPtr driver,
7b4659
+                               virQEMUCapsPtr qemuCaps,
7b4659
                                const char *xml,
7b4659
                                unsigned int flags)
7b4659
 {
7b4659
@@ -1400,7 +1402,7 @@ qemuMigrationCookieXMLParseStr(qemuMigrationCookiePtr mig,
7b4659
     if (!(doc = virXMLParseStringCtxt(xml, _("(qemu_migration_cookie)"), &ctxt)))
7b4659
         goto cleanup;
7b4659
 
7b4659
-    ret = qemuMigrationCookieXMLParse(mig, driver, doc, ctxt, flags);
7b4659
+    ret = qemuMigrationCookieXMLParse(mig, driver, qemuCaps, doc, ctxt, flags);
7b4659
 
7b4659
  cleanup:
7b4659
     xmlXPathFreeContext(ctxt);
7b4659
@@ -1501,6 +1503,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver,
7b4659
     if (cookiein && cookieinlen &&
7b4659
         qemuMigrationCookieXMLParseStr(mig,
7b4659
                                        driver,
7b4659
+                                       priv->qemuCaps,
7b4659
                                        cookiein,
7b4659
                                        flags) < 0)
7b4659
         goto error;
7b4659
-- 
7b4659
2.22.1
7b4659