7b4659
From 0379563f7961e019ceef28ed28e56bb24f78d778 Mon Sep 17 00:00:00 2001
7b4659
Message-Id: <0379563f7961e019ceef28ed28e56bb24f78d778@dist-git>
7b4659
From: Jiri Denemark <jdenemar@redhat.com>
7b4659
Date: Fri, 16 Aug 2019 14:52:28 +0200
7b4659
Subject: [PATCH] qemu: Pass qemuCaps to qemuDomainDefFormatBufInternal
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 qemuDomainDefFormatBufInternal.
7b4659
7b4659
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7b4659
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7b4659
(cherry picked from commit 900c5952499fb233a9c0d2e6d0a5fde84a99cf72)
7b4659
7b4659
Conflicts:
7b4659
	src/qemu/qemu_driver.c
7b4659
            - no checkpoint APIs
7b4659
            - no VIR_AUTOUNREF
7b4659
            - ProcessAttach and XMLFromNative APIs were removed upstream
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: <fb9a50220d762c69ee9d8b38c60a03b061b4127b.1565959866.git.jdenemar@redhat.com>
7b4659
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7b4659
---
7b4659
 src/qemu/qemu_domain.c           | 37 ++++++++++++++++++++------------
7b4659
 src/qemu/qemu_domain.h           |  3 +++
7b4659
 src/qemu/qemu_driver.c           | 22 ++++++++++++-------
7b4659
 src/qemu/qemu_migration.c        |  6 +++---
7b4659
 src/qemu/qemu_migration_cookie.c |  9 ++++++--
7b4659
 src/qemu/qemu_process.c          | 11 +++++-----
7b4659
 6 files changed, 56 insertions(+), 32 deletions(-)
7b4659
7b4659
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
7b4659
index bf6013d42a..249ec4d259 100644
7b4659
--- a/src/qemu/qemu_domain.c
7b4659
+++ b/src/qemu/qemu_domain.c
7b4659
@@ -7230,7 +7230,7 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
7b4659
     virDomainDefPtr ret = NULL;
7b4659
     char *xml;
7b4659
 
7b4659
-    if (!(xml = qemuDomainDefFormatXML(driver, src, flags)))
7b4659
+    if (!(xml = qemuDomainDefFormatXML(driver, qemuCaps, src, flags)))
7b4659
         return NULL;
7b4659
 
7b4659
     ret = qemuDomainDefFromXML(driver, qemuCaps, xml);
7b4659
@@ -7242,6 +7242,7 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
7b4659
 
7b4659
 static int
7b4659
 qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
7b4659
+                               virQEMUCapsPtr qemuCaps,
7b4659
                                virDomainDefPtr def,
7b4659
                                virCPUDefPtr origCPU,
7b4659
                                unsigned int flags,
7b4659
@@ -7250,7 +7251,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
7b4659
     int ret = -1;
7b4659
     virDomainDefPtr copy = NULL;
7b4659
     virCapsPtr caps = NULL;
7b4659
-    virQEMUCapsPtr qemuCaps = NULL;
7b4659
+    virQEMUCapsPtr qCaps = NULL;
7b4659
 
7b4659
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
7b4659
         goto cleanup;
7b4659
@@ -7258,7 +7259,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
7b4659
     if (!(flags & (VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_MIGRATABLE)))
7b4659
         goto format;
7b4659
 
7b4659
-    if (!(copy = virDomainDefCopy(def, caps, driver->xmlopt, NULL,
7b4659
+    if (!(copy = virDomainDefCopy(def, caps, driver->xmlopt, qemuCaps,
7b4659
                                   flags & VIR_DOMAIN_XML_MIGRATABLE)))
7b4659
         goto cleanup;
7b4659
 
7b4659
@@ -7269,13 +7270,17 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
7b4659
         def->cpu &&
7b4659
         (def->cpu->mode != VIR_CPU_MODE_CUSTOM ||
7b4659
          def->cpu->model)) {
7b4659
-        if (!(qemuCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
7b4659
-                                                    def->emulator,
7b4659
-                                                    def->os.machine)))
7b4659
-            goto cleanup;
7b4659
+        if (qemuCaps) {
7b4659
+            qCaps = virObjectRef(qemuCaps);
7b4659
+        } else {
7b4659
+            if (!(qCaps = virQEMUCapsCacheLookupCopy(driver->qemuCapsCache,
7b4659
+                                                     def->emulator,
7b4659
+                                                     def->os.machine)))
7b4659
+                goto cleanup;
7b4659
+        }
7b4659
 
7b4659
         if (virCPUUpdate(def->os.arch, def->cpu,
7b4659
-                         virQEMUCapsGetHostModel(qemuCaps, def->virtType,
7b4659
+                         virQEMUCapsGetHostModel(qCaps, def->virtType,
7b4659
                                                  VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0)
7b4659
             goto cleanup;
7b4659
     }
7b4659
@@ -7424,30 +7429,32 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
7b4659
  cleanup:
7b4659
     virDomainDefFree(copy);
7b4659
     virObjectUnref(caps);
7b4659
-    virObjectUnref(qemuCaps);
7b4659
+    virObjectUnref(qCaps);
7b4659
     return ret;
7b4659
 }
7b4659
 
7b4659
 
7b4659
 int
7b4659
 qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
7b4659
+                       virQEMUCapsPtr qemuCaps,
7b4659
                        virDomainDefPtr def,
7b4659
                        unsigned int flags,
7b4659
                        virBufferPtr buf)
7b4659
 {
7b4659
-    return qemuDomainDefFormatBufInternal(driver, def, NULL, flags, buf);
7b4659
+    return qemuDomainDefFormatBufInternal(driver, qemuCaps, def, NULL, flags, buf);
7b4659
 }
7b4659
 
7b4659
 
7b4659
 static char *
7b4659
 qemuDomainDefFormatXMLInternal(virQEMUDriverPtr driver,
7b4659
+                               virQEMUCapsPtr qemuCaps,
7b4659
                                virDomainDefPtr def,
7b4659
                                virCPUDefPtr origCPU,
7b4659
                                unsigned int flags)
7b4659
 {
7b4659
     virBuffer buf = VIR_BUFFER_INITIALIZER;
7b4659
 
7b4659
-    if (qemuDomainDefFormatBufInternal(driver, def, origCPU, flags, &buf) < 0)
7b4659
+    if (qemuDomainDefFormatBufInternal(driver, qemuCaps, def, origCPU, flags, &buf) < 0)
7b4659
         return NULL;
7b4659
 
7b4659
     return virBufferContentAndReset(&buf;;
7b4659
@@ -7456,10 +7463,11 @@ qemuDomainDefFormatXMLInternal(virQEMUDriverPtr driver,
7b4659
 
7b4659
 char *
7b4659
 qemuDomainDefFormatXML(virQEMUDriverPtr driver,
7b4659
+                       virQEMUCapsPtr qemuCaps,
7b4659
                        virDomainDefPtr def,
7b4659
                        unsigned int flags)
7b4659
 {
7b4659
-    return qemuDomainDefFormatXMLInternal(driver, def, NULL, flags);
7b4659
+    return qemuDomainDefFormatXMLInternal(driver, qemuCaps, def, NULL, flags);
7b4659
 }
7b4659
 
7b4659
 
7b4659
@@ -7478,11 +7486,12 @@ char *qemuDomainFormatXML(virQEMUDriverPtr driver,
7b4659
         origCPU = priv->origCPU;
7b4659
     }
7b4659
 
7b4659
-    return qemuDomainDefFormatXMLInternal(driver, def, origCPU, flags);
7b4659
+    return qemuDomainDefFormatXMLInternal(driver, priv->qemuCaps, def, origCPU, flags);
7b4659
 }
7b4659
 
7b4659
 char *
7b4659
 qemuDomainDefFormatLive(virQEMUDriverPtr driver,
7b4659
+                        virQEMUCapsPtr qemuCaps,
7b4659
                         virDomainDefPtr def,
7b4659
                         virCPUDefPtr origCPU,
7b4659
                         bool inactive,
7b4659
@@ -7495,7 +7504,7 @@ qemuDomainDefFormatLive(virQEMUDriverPtr driver,
7b4659
     if (compatible)
7b4659
         flags |= VIR_DOMAIN_XML_MIGRATABLE;
7b4659
 
7b4659
-    return qemuDomainDefFormatXMLInternal(driver, def, origCPU, flags);
7b4659
+    return qemuDomainDefFormatXMLInternal(driver, qemuCaps, def, origCPU, flags);
7b4659
 }
7b4659
 
7b4659
 
7b4659
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
7b4659
index 29283105cb..9546216f30 100644
7b4659
--- a/src/qemu/qemu_domain.h
7b4659
+++ b/src/qemu/qemu_domain.h
7b4659
@@ -599,11 +599,13 @@ virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
7b4659
                                   unsigned int flags);
7b4659
 
7b4659
 int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
7b4659
+                           virQEMUCapsPtr qemuCaps,
7b4659
                            virDomainDefPtr vm,
7b4659
                            unsigned int flags,
7b4659
                            virBuffer *buf);
7b4659
 
7b4659
 char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
7b4659
+                             virQEMUCapsPtr qemuCaps,
7b4659
                              virDomainDefPtr vm,
7b4659
                              unsigned int flags);
7b4659
 
7b4659
@@ -612,6 +614,7 @@ char *qemuDomainFormatXML(virQEMUDriverPtr driver,
7b4659
                           unsigned int flags);
7b4659
 
7b4659
 char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
7b4659
+                              virQEMUCapsPtr qemuCaps,
7b4659
                               virDomainDefPtr def,
7b4659
                               virCPUDefPtr origCPU,
7b4659
                               bool inactive,
7b4659
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7b4659
index a486c66a5f..7d87215904 100644
7b4659
--- a/src/qemu/qemu_driver.c
7b4659
+++ b/src/qemu/qemu_driver.c
7b4659
@@ -3316,9 +3316,10 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
7b4659
             virDomainDefFree(def);
7b4659
             goto endjob;
7b4659
         }
7b4659
-        xml = qemuDomainDefFormatLive(driver, def, NULL, true, true);
7b4659
+        xml = qemuDomainDefFormatLive(driver, priv->qemuCaps, def, NULL, true, true);
7b4659
     } else {
7b4659
-        xml = qemuDomainDefFormatLive(driver, vm->def, priv->origCPU, true, true);
7b4659
+        xml = qemuDomainDefFormatLive(driver, priv->qemuCaps, vm->def,
7b4659
+                                      priv->origCPU, true, true);
7b4659
     }
7b4659
     if (!xml) {
7b4659
         virReportError(VIR_ERR_OPERATION_FAILED,
7b4659
@@ -6787,7 +6788,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
7b4659
     if (virDomainSaveImageGetXMLDescEnsureACL(conn, def) < 0)
7b4659
         goto cleanup;
7b4659
 
7b4659
-    ret = qemuDomainDefFormatXML(driver, def, flags);
7b4659
+    ret = qemuDomainDefFormatXML(driver, NULL, def, flags);
7b4659
 
7b4659
  cleanup:
7b4659
     virQEMUSaveDataFree(data);
7b4659
@@ -6840,7 +6841,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
7b4659
 
7b4659
     VIR_FREE(data->xml);
7b4659
 
7b4659
-    if (!(data->xml = qemuDomainDefFormatXML(driver, newdef,
7b4659
+    if (!(data->xml = qemuDomainDefFormatXML(driver, NULL, newdef,
7b4659
                                              VIR_DOMAIN_XML_INACTIVE |
7b4659
                                              VIR_DOMAIN_XML_SECURE |
7b4659
                                              VIR_DOMAIN_XML_MIGRATABLE)))
7b4659
@@ -6879,6 +6880,7 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
7b4659
     virDomainDefPtr def = NULL;
7b4659
     int fd = -1;
7b4659
     virQEMUSaveDataPtr data = NULL;
7b4659
+    qemuDomainObjPrivatePtr priv;
7b4659
 
7b4659
     /* We only take subset of virDomainDefFormat flags.  */
7b4659
     virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
7b4659
@@ -6886,6 +6888,8 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
7b4659
     if (!(vm = qemuDomObjFromDomain(dom)))
7b4659
         return ret;
7b4659
 
7b4659
+    priv = vm->privateData;
7b4659
+
7b4659
     if (virDomainManagedSaveGetXMLDescEnsureACL(dom->conn, vm->def, flags) < 0)
7b4659
         goto cleanup;
7b4659
 
7b4659
@@ -6902,7 +6906,7 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
7b4659
                                       false, NULL, false, false)) < 0)
7b4659
         goto cleanup;
7b4659
 
7b4659
-    ret = qemuDomainDefFormatXML(driver, def, flags);
7b4659
+    ret = qemuDomainDefFormatXML(driver, priv->qemuCaps, def, flags);
7b4659
 
7b4659
  cleanup:
7b4659
     virQEMUSaveDataFree(data);
7b4659
@@ -7097,7 +7101,7 @@ static char *qemuConnectDomainXMLFromNative(virConnectPtr conn,
7b4659
     if (!def->name && VIR_STRDUP(def->name, "unnamed") < 0)
7b4659
         goto cleanup;
7b4659
 
7b4659
-    xml = qemuDomainDefFormatXML(driver, def, VIR_DOMAIN_XML_INACTIVE);
7b4659
+    xml = qemuDomainDefFormatXML(driver, NULL, def, VIR_DOMAIN_XML_INACTIVE);
7b4659
 
7b4659
  cleanup:
7b4659
     virDomainDefFree(def);
7b4659
@@ -15151,7 +15155,8 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
7b4659
                                                     "snapshot", false)) < 0)
7b4659
             goto cleanup;
7b4659
 
7b4659
-        if (!(xml = qemuDomainDefFormatLive(driver, vm->def, priv->origCPU,
7b4659
+        if (!(xml = qemuDomainDefFormatLive(driver, priv->qemuCaps,
7b4659
+                                            vm->def, priv->origCPU,
7b4659
                                             true, true)) ||
7b4659
             !(snap->def->cookie = (virObjectPtr) qemuDomainSaveCookieNew(vm)))
7b4659
             goto cleanup;
7b4659
@@ -15395,7 +15400,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
7b4659
     } else {
7b4659
         /* Easiest way to clone inactive portion of vm->def is via
7b4659
          * conversion in and back out of xml.  */
7b4659
-        if (!(xml = qemuDomainDefFormatLive(driver, vm->def, priv->origCPU,
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
                                                  VIR_DOMAIN_DEF_PARSE_INACTIVE |
7b4659
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
7b4659
index 4af105b997..111038b971 100644
7b4659
--- a/src/qemu/qemu_migration.c
7b4659
+++ b/src/qemu/qemu_migration.c
7b4659
@@ -2081,9 +2081,9 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
7b4659
         if (!qemuDomainCheckABIStability(driver, vm, def))
7b4659
             goto cleanup;
7b4659
 
7b4659
-        rv = qemuDomainDefFormatLive(driver, def, NULL, false, true);
7b4659
+        rv = qemuDomainDefFormatLive(driver, priv->qemuCaps, def, NULL, false, true);
7b4659
     } else {
7b4659
-        rv = qemuDomainDefFormatLive(driver, vm->def, priv->origCPU,
7b4659
+        rv = qemuDomainDefFormatLive(driver, priv->qemuCaps, vm->def, priv->origCPU,
7b4659
                                      false, true);
7b4659
     }
7b4659
 
7b4659
@@ -2352,7 +2352,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
7b4659
         char *xml;
7b4659
         int hookret;
7b4659
 
7b4659
-        if (!(xml = qemuDomainDefFormatXML(driver, *def,
7b4659
+        if (!(xml = qemuDomainDefFormatXML(driver, NULL, *def,
7b4659
                                            VIR_DOMAIN_XML_SECURE |
7b4659
                                            VIR_DOMAIN_XML_MIGRATABLE)))
7b4659
             goto cleanup;
7b4659
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
7b4659
index 60df449d53..901b1ae9ac 100644
7b4659
--- a/src/qemu/qemu_migration_cookie.c
7b4659
+++ b/src/qemu/qemu_migration_cookie.c
7b4659
@@ -777,6 +777,7 @@ qemuMigrationCookieCapsXMLFormat(virBufferPtr buf,
7b4659
 
7b4659
 static int
7b4659
 qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver,
7b4659
+                             virQEMUCapsPtr qemuCaps,
7b4659
                              virBufferPtr buf,
7b4659
                              qemuMigrationCookiePtr mig)
7b4659
 {
7b4659
@@ -818,6 +819,7 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver,
7b4659
     if ((mig->flags & QEMU_MIGRATION_COOKIE_PERSISTENT) &&
7b4659
         mig->persistent) {
7b4659
         if (qemuDomainDefFormatBuf(driver,
7b4659
+                                   qemuCaps,
7b4659
                                    mig->persistent,
7b4659
                                    VIR_DOMAIN_XML_INACTIVE |
7b4659
                                    VIR_DOMAIN_XML_SECURE |
7b4659
@@ -869,11 +871,12 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver,
7b4659
 
7b4659
 static char *
7b4659
 qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver,
7b4659
+                                virQEMUCapsPtr qemuCaps,
7b4659
                                 qemuMigrationCookiePtr mig)
7b4659
 {
7b4659
     virBuffer buf = VIR_BUFFER_INITIALIZER;
7b4659
 
7b4659
-    if (qemuMigrationCookieXMLFormat(driver, &buf, mig) < 0) {
7b4659
+    if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0) {
7b4659
         virBufferFreeAndReset(&buf;;
7b4659
         return NULL;
7b4659
     }
7b4659
@@ -1416,6 +1419,8 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
7b4659
                         int *cookieoutlen,
7b4659
                         unsigned int flags)
7b4659
 {
7b4659
+    qemuDomainObjPrivatePtr priv = dom->privateData;
7b4659
+
7b4659
     if (!cookieout || !cookieoutlen)
7b4659
         return 0;
7b4659
 
7b4659
@@ -1459,7 +1464,7 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
7b4659
         qemuMigrationCookieAddCaps(mig, dom, party) < 0)
7b4659
         return -1;
7b4659
 
7b4659
-    if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, mig)))
7b4659
+    if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, priv->qemuCaps, mig)))
7b4659
         return -1;
7b4659
 
7b4659
     *cookieoutlen = strlen(*cookieout) + 1;
7b4659
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
7b4659
index 9e6e6528e2..34686b4d92 100644
7b4659
--- a/src/qemu/qemu_process.c
7b4659
+++ b/src/qemu/qemu_process.c
7b4659
@@ -4434,13 +4434,14 @@ qemuProcessStartHook(virQEMUDriverPtr driver,
7b4659
                      virHookQemuOpType op,
7b4659
                      virHookSubopType subop)
7b4659
 {
7b4659
+    qemuDomainObjPrivatePtr priv = vm->privateData;
7b4659
     char *xml;
7b4659
     int ret;
7b4659
 
7b4659
     if (!virHookPresent(VIR_HOOK_DRIVER_QEMU))
7b4659
         return 0;
7b4659
 
7b4659
-    if (!(xml = qemuDomainDefFormatXML(driver, vm->def, 0)))
7b4659
+    if (!(xml = qemuDomainDefFormatXML(driver, priv->qemuCaps, vm->def, 0)))
7b4659
         return -1;
7b4659
 
7b4659
     ret = virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name, op, subop,
7b4659
@@ -7091,7 +7092,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
7b4659
 
7b4659
     /* now that we know it's stopped call the hook if present */
7b4659
     if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
7b4659
-        char *xml = qemuDomainDefFormatXML(driver, vm->def, 0);
7b4659
+        char *xml = qemuDomainDefFormatXML(driver, NULL, vm->def, 0);
7b4659
 
7b4659
         /* we can't stop the operation even if the script raised an error */
7b4659
         ignore_value(virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
7b4659
@@ -7249,7 +7250,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
7b4659
 
7b4659
     /* The "release" hook cleans up additional resources */
7b4659
     if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
7b4659
-        char *xml = qemuDomainDefFormatXML(driver, vm->def, 0);
7b4659
+        char *xml = qemuDomainDefFormatXML(driver, NULL, vm->def, 0);
7b4659
 
7b4659
         /* we can't stop the operation even if the script raised an error */
7b4659
         virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
7b4659
@@ -7473,7 +7474,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
7b4659
 
7b4659
     /* Run an hook to allow admins to do some magic */
7b4659
     if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
7b4659
-        char *xml = qemuDomainDefFormatXML(driver, vm->def, 0);
7b4659
+        char *xml = qemuDomainDefFormatXML(driver, priv->qemuCaps, vm->def, 0);
7b4659
         int hookret;
7b4659
 
7b4659
         hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
7b4659
@@ -7934,7 +7935,7 @@ qemuProcessReconnect(void *opaque)
7b4659
 
7b4659
     /* Run an hook to allow admins to do some magic */
7b4659
     if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
7b4659
-        char *xml = qemuDomainDefFormatXML(driver, obj->def, 0);
7b4659
+        char *xml = qemuDomainDefFormatXML(driver, priv->qemuCaps, obj->def, 0);
7b4659
         int hookret;
7b4659
 
7b4659
         hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, obj->def->name,
7b4659
-- 
7b4659
2.22.1
7b4659