d759b5
From 6390ac69fb3686455e81c562c5cd319ed02ac2aa Mon Sep 17 00:00:00 2001
d759b5
Message-Id: <6390ac69fb3686455e81c562c5cd319ed02ac2aa@dist-git>
7b4659
From: Jiri Denemark <jdenemar@redhat.com>
7b4659
Date: Fri, 16 Aug 2019 14:52:31 +0200
7b4659
Subject: [PATCH] qemu: Pass correct qemuCaps to virDomainDefParseString
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 virDomainDefParseString.
7b4659
7b4659
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7b4659
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7b4659
(cherry picked from commit 6e7c33dad7f2f90182c452917f3a555e2c878d42)
7b4659
7b4659
Conflicts:
7b4659
	src/qemu/qemu_driver.c
7b4659
            - snapshots are not based on virDomainMomentDef
7b4659
            - no checkpoint APIs
7b4659
7b4659
https://bugzilla.redhat.com/show_bug.cgi?id=1731783
7b4659
7b4659
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7b4659
Message-Id: <2728b24106e1e361cf9766ea8f9eeec782df6b20.1565959866.git.jdenemar@redhat.com>
7b4659
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7b4659
---
7b4659
 src/qemu/qemu_driver.c | 6 ++++--
7b4659
 1 file changed, 4 insertions(+), 2 deletions(-)
7b4659
7b4659
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7b4659
index 590596a421..3f8530eb0e 100644
7b4659
--- a/src/qemu/qemu_driver.c
7b4659
+++ b/src/qemu/qemu_driver.c
7b4659
@@ -3307,7 +3307,8 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
7b4659
     if (xmlin) {
7b4659
         virDomainDefPtr def = NULL;
7b4659
 
7b4659
-        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt, NULL,
7b4659
+        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
7b4659
+                                            priv->qemuCaps,
7b4659
                                             VIR_DOMAIN_DEF_PARSE_INACTIVE |
7b4659
                                             VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) {
7b4659
             goto endjob;
7b4659
@@ -15405,7 +15406,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
7b4659
         if (!(xml = qemuDomainDefFormatLive(driver, priv->qemuCaps,
7b4659
                                             vm->def, priv->origCPU,
7b4659
                                             true, true)) ||
7b4659
-            !(def->dom = virDomainDefParseString(xml, caps, driver->xmlopt, NULL,
7b4659
+            !(def->dom = virDomainDefParseString(xml, caps, driver->xmlopt,
7b4659
+                                                 priv->qemuCaps,
7b4659
                                                  VIR_DOMAIN_DEF_PARSE_INACTIVE |
7b4659
                                                  VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
7b4659
             goto endjob;
7b4659
-- 
7b4659
2.22.1
7b4659