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

[libvirt] [PATCH 05/10] qemu: Pass correct qemuCaps to virDomainDefParseString



Since qemuDomainDefPostParse callback requires qemuCaps, we need to make
sure it gets the capabilities stored in the domain's private data if the
domain is running. Passing NULL may cause QEMU capabilities probing to
be triggered in case QEMU binary changed in the meantime. When this
happens while a running domain object is locked, QMP event delivered to
the domain before QEMU capabilities probing finishes will deadlock the
event loop.

This patch fixes all paths leading to virDomainDefParseString.

Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/qemu/qemu_driver.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1139fde77a..3004433aa5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3437,7 +3437,8 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
     if (xmlin) {
         virDomainDefPtr def = NULL;
 
-        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt, NULL,
+        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
+                                            priv->qemuCaps,
                                             VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                             VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) {
             goto endjob;
@@ -15907,7 +15908,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
         if (!(xml = qemuDomainDefFormatLive(driver, priv->qemuCaps,
                                             vm->def, priv->origCPU,
                                             true, true)) ||
-            !(def->parent.dom = virDomainDefParseString(xml, caps, driver->xmlopt, NULL,
+            !(def->parent.dom = virDomainDefParseString(xml, caps, driver->xmlopt,
+                                                        priv->qemuCaps,
                                                         VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                                         VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
             goto endjob;
@@ -17008,7 +17010,8 @@ qemuDomainCheckpointPrepare(virQEMUDriverPtr driver, virCapsPtr caps,
     if (!(xml = qemuDomainDefFormatLive(driver, priv->qemuCaps,
                                         vm->def, priv->origCPU,
                                         true, true)) ||
-        !(def->parent.dom = virDomainDefParseString(xml, caps, driver->xmlopt, NULL,
+        !(def->parent.dom = virDomainDefParseString(xml, caps, driver->xmlopt,
+                                                    priv->qemuCaps,
                                                     VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                                     VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
         goto cleanup;
-- 
2.22.0


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