render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
99cbc7
From 04780ba930ff77532ed56d3b41bde0aa6cd5caee Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <04780ba930ff77532ed56d3b41bde0aa6cd5caee@dist-git>
99cbc7
From: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Date: Fri, 16 Aug 2019 14:52:33 +0200
99cbc7
Subject: [PATCH] qemu: Pass correct qemuCaps to virDomainDefCopy
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Since qemuDomainDefPostParse callback requires qemuCaps, we need to make
99cbc7
sure it gets the capabilities stored in the domain's private data if the
99cbc7
domain is running. Passing NULL may cause QEMU capabilities probing to
99cbc7
be triggered in case QEMU binary changed in the meantime. When this
99cbc7
happens while a running domain object is locked, QMP event delivered to
99cbc7
the domain before QEMU capabilities probing finishes will deadlock the
99cbc7
event loop.
99cbc7
99cbc7
Several general functions from domain_conf.c were lazily passing NULL as
99cbc7
the parseOpaque pointer instead of letting their callers pass the right
99cbc7
data. This patch fixes all paths leading to virDomainDefCopy to do the
99cbc7
right thing.
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
(cherry picked from commit bbcfa07bea4fbe2fe8a51f99f20c77ddefd2d40d)
99cbc7
99cbc7
Conflicts:
99cbc7
	src/lxc/lxc_driver.c
99cbc7
            - context
99cbc7
99cbc7
	src/qemu/qemu_driver.c
99cbc7
            - qemuDomainAttachDeviceLiveAndConfig is quite different
99cbc7
            - context in qemuDomainRevertToSnapshot
99cbc7
            - ProcessAttach API was removed upstream
99cbc7
99cbc7
	src/uml/uml_driver.c
99cbc7
            - uml driver was removed upstream
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1731783
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Message-Id: <eadbc85f47469abe211d649d5414c2474a65f56c.1565959866.git.jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/conf/domain_conf.c      | 18 +++++++++++-------
99cbc7
 src/conf/domain_conf.h      |  9 ++++++---
99cbc7
 src/libxl/libxl_domain.c    |  2 +-
99cbc7
 src/libxl/libxl_driver.c    | 10 +++++-----
99cbc7
 src/libxl/libxl_migration.c |  2 +-
99cbc7
 src/lxc/lxc_driver.c        |  8 ++++----
99cbc7
 src/lxc/lxc_process.c       |  2 +-
99cbc7
 src/qemu/qemu_driver.c      | 28 ++++++++++++++++++++--------
99cbc7
 src/qemu/qemu_migration.c   |  4 +++-
99cbc7
 src/qemu/qemu_process.c     |  4 ++--
99cbc7
 src/test/test_driver.c      |  2 +-
99cbc7
 src/uml/uml_driver.c        |  2 +-
99cbc7
 tests/qemuhotplugtest.c     |  2 +-
99cbc7
 13 files changed, 57 insertions(+), 36 deletions(-)
99cbc7
99cbc7
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
99cbc7
index aaf6a6bab1..0fdf1742fd 100644
99cbc7
--- a/src/conf/domain_conf.c
99cbc7
+++ b/src/conf/domain_conf.c
99cbc7
@@ -3374,7 +3374,8 @@ virDomainObjWaitUntil(virDomainObjPtr vm,
99cbc7
 int
99cbc7
 virDomainObjSetDefTransient(virCapsPtr caps,
99cbc7
                             virDomainXMLOptionPtr xmlopt,
99cbc7
-                            virDomainObjPtr domain)
99cbc7
+                            virDomainObjPtr domain,
99cbc7
+                            void *parseOpaque)
99cbc7
 {
99cbc7
     int ret = -1;
99cbc7
 
99cbc7
@@ -3384,7 +3385,8 @@ virDomainObjSetDefTransient(virCapsPtr caps,
99cbc7
     if (domain->newDef)
99cbc7
         return 0;
99cbc7
 
99cbc7
-    if (!(domain->newDef = virDomainDefCopy(domain->def, caps, xmlopt, NULL, false)))
99cbc7
+    if (!(domain->newDef = virDomainDefCopy(domain->def, caps, xmlopt,
99cbc7
+                                            parseOpaque, false)))
99cbc7
         goto out;
99cbc7
 
99cbc7
     ret = 0;
99cbc7
@@ -3423,10 +3425,11 @@ virDomainObjRemoveTransientDef(virDomainObjPtr domain)
99cbc7
 virDomainDefPtr
99cbc7
 virDomainObjGetPersistentDef(virCapsPtr caps,
99cbc7
                              virDomainXMLOptionPtr xmlopt,
99cbc7
-                             virDomainObjPtr domain)
99cbc7
+                             virDomainObjPtr domain,
99cbc7
+                             void *parseOpaque)
99cbc7
 {
99cbc7
     if (virDomainObjIsActive(domain) &&
99cbc7
-        virDomainObjSetDefTransient(caps, xmlopt, domain) < 0)
99cbc7
+        virDomainObjSetDefTransient(caps, xmlopt, domain, parseOpaque) < 0)
99cbc7
         return NULL;
99cbc7
 
99cbc7
     if (domain->newDef)
99cbc7
@@ -29180,12 +29183,13 @@ virDomainDefCopy(virDomainDefPtr src,
99cbc7
 virDomainDefPtr
99cbc7
 virDomainObjCopyPersistentDef(virDomainObjPtr dom,
99cbc7
                               virCapsPtr caps,
99cbc7
-                              virDomainXMLOptionPtr xmlopt)
99cbc7
+                              virDomainXMLOptionPtr xmlopt,
99cbc7
+                              void *parseOpaque)
99cbc7
 {
99cbc7
     virDomainDefPtr cur;
99cbc7
 
99cbc7
-    cur = virDomainObjGetPersistentDef(caps, xmlopt, dom);
99cbc7
-    return virDomainDefCopy(cur, caps, xmlopt, NULL, false);
99cbc7
+    cur = virDomainObjGetPersistentDef(caps, xmlopt, dom, parseOpaque);
99cbc7
+    return virDomainDefCopy(cur, caps, xmlopt, parseOpaque, false);
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
99cbc7
index 2d272f907f..9e4fed6d4e 100644
99cbc7
--- a/src/conf/domain_conf.h
99cbc7
+++ b/src/conf/domain_conf.h
99cbc7
@@ -2940,12 +2940,14 @@ void virDomainObjAssignDef(virDomainObjPtr domain,
99cbc7
                            virDomainDefPtr *oldDef);
99cbc7
 int virDomainObjSetDefTransient(virCapsPtr caps,
99cbc7
                                 virDomainXMLOptionPtr xmlopt,
99cbc7
-                                virDomainObjPtr domain);
99cbc7
+                                virDomainObjPtr domain,
99cbc7
+                                void *parseOpaque);
99cbc7
 void virDomainObjRemoveTransientDef(virDomainObjPtr domain);
99cbc7
 virDomainDefPtr
99cbc7
 virDomainObjGetPersistentDef(virCapsPtr caps,
99cbc7
                              virDomainXMLOptionPtr xmlopt,
99cbc7
-                             virDomainObjPtr domain);
99cbc7
+                             virDomainObjPtr domain,
99cbc7
+                             void *parseOpaque);
99cbc7
 
99cbc7
 int virDomainObjUpdateModificationImpact(virDomainObjPtr vm,
99cbc7
                                          unsigned int *flags);
99cbc7
@@ -2966,7 +2968,8 @@ virDomainDefPtr virDomainDefCopy(virDomainDefPtr src,
99cbc7
                                  bool migratable);
99cbc7
 virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
99cbc7
                                               virCapsPtr caps,
99cbc7
-                                              virDomainXMLOptionPtr xmlopt);
99cbc7
+                                              virDomainXMLOptionPtr xmlopt,
99cbc7
+                                              void *parseOpaque);
99cbc7
 
99cbc7
 typedef enum {
99cbc7
     /* parse internal domain status information */
99cbc7
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
99cbc7
index 2ab78ac9a5..f52540e6a7 100644
99cbc7
--- a/src/libxl/libxl_domain.c
99cbc7
+++ b/src/libxl/libxl_domain.c
99cbc7
@@ -1208,7 +1208,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
99cbc7
         VIR_FREE(managed_save_path);
99cbc7
     }
99cbc7
 
99cbc7
-    if (virDomainObjSetDefTransient(cfg->caps, driver->xmlopt, vm) < 0)
99cbc7
+    if (virDomainObjSetDefTransient(cfg->caps, driver->xmlopt, vm, NULL) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     /* Run an early hook to set-up missing devices */
99cbc7
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
99cbc7
index 5a5e792957..be6b66ce7e 100644
99cbc7
--- a/src/libxl/libxl_driver.c
99cbc7
+++ b/src/libxl/libxl_driver.c
99cbc7
@@ -1461,7 +1461,7 @@ virDomainLiveConfigHelperMethod(virCapsPtr caps,
99cbc7
         return -1;
99cbc7
 
99cbc7
     if (*flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
-        if (!(*persistentDef = virDomainObjGetPersistentDef(caps, xmlopt, dom))) {
99cbc7
+        if (!(*persistentDef = virDomainObjGetPersistentDef(caps, xmlopt, dom, NULL))) {
99cbc7
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
99cbc7
                            _("Get persistent config failed"));
99cbc7
             return -1;
99cbc7
@@ -2147,7 +2147,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
99cbc7
         goto endjob;
99cbc7
     }
99cbc7
 
99cbc7
-    if (!(def = virDomainObjGetPersistentDef(cfg->caps, driver->xmlopt, vm)))
99cbc7
+    if (!(def = virDomainObjGetPersistentDef(cfg->caps, driver->xmlopt, vm, NULL)))
99cbc7
         goto endjob;
99cbc7
 
99cbc7
     maplen = VIR_CPU_MAPLEN(nvcpus);
99cbc7
@@ -3961,7 +3961,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
99cbc7
 
99cbc7
         /* Make a copy for updated domain. */
99cbc7
         if (!(vmdef = virDomainObjCopyPersistentDef(vm, cfg->caps,
99cbc7
-                                                    driver->xmlopt)))
99cbc7
+                                                    driver->xmlopt, NULL)))
99cbc7
             goto endjob;
99cbc7
 
99cbc7
         if (libxlDomainAttachDeviceConfig(vmdef, dev) < 0)
99cbc7
@@ -4051,7 +4051,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
99cbc7
 
99cbc7
         /* Make a copy for updated domain. */
99cbc7
         if (!(vmdef = virDomainObjCopyPersistentDef(vm, cfg->caps,
99cbc7
-                                                    driver->xmlopt)))
99cbc7
+                                                    driver->xmlopt, NULL)))
99cbc7
             goto endjob;
99cbc7
 
99cbc7
         if (libxlDomainDetachDeviceConfig(vmdef, dev) < 0)
99cbc7
@@ -4138,7 +4138,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
99cbc7
 
99cbc7
         /* Make a copy for updated domain. */
99cbc7
         if (!(vmdef = virDomainObjCopyPersistentDef(vm, cfg->caps,
99cbc7
-                                                    driver->xmlopt)))
99cbc7
+                                                    driver->xmlopt, NULL)))
99cbc7
             goto cleanup;
99cbc7
 
99cbc7
         if ((ret = libxlDomainUpdateDeviceConfig(vmdef, dev)) < 0)
99cbc7
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
99cbc7
index b2e5847c58..f207bd7b02 100644
99cbc7
--- a/src/libxl/libxl_migration.c
99cbc7
+++ b/src/libxl/libxl_migration.c
99cbc7
@@ -1293,7 +1293,7 @@ libxlDomainMigrationDstFinish(virConnectPtr dconn,
99cbc7
 
99cbc7
         vm->persistent = 1;
99cbc7
         if (!(vmdef = virDomainObjGetPersistentDef(cfg->caps,
99cbc7
-                                                   driver->xmlopt, vm)))
99cbc7
+                                                   driver->xmlopt, vm, NULL)))
99cbc7
             goto cleanup;
99cbc7
 
99cbc7
         if (virDomainSaveConfig(cfg->configDir, cfg->caps, vmdef) < 0)
99cbc7
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
99cbc7
index f9794e0655..b182fa3759 100644
99cbc7
--- a/src/lxc/lxc_driver.c
99cbc7
+++ b/src/lxc/lxc_driver.c
99cbc7
@@ -1936,7 +1936,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
99cbc7
 
99cbc7
     if (persistentDef) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        persistentDefCopy = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        persistentDefCopy = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, NULL);
99cbc7
         if (!persistentDefCopy)
99cbc7
             goto endjob;
99cbc7
     }
99cbc7
@@ -4755,7 +4755,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, NULL);
99cbc7
         if (!vmdef)
99cbc7
             goto endjob;
99cbc7
 
99cbc7
@@ -4870,7 +4870,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, NULL);
99cbc7
         if (!vmdef)
99cbc7
             goto endjob;
99cbc7
 
99cbc7
@@ -4961,7 +4961,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, NULL);
99cbc7
         if (!vmdef)
99cbc7
             goto endjob;
99cbc7
 
99cbc7
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
99cbc7
index 14502e12fe..d40c7acaaa 100644
99cbc7
--- a/src/lxc/lxc_process.c
99cbc7
+++ b/src/lxc/lxc_process.c
99cbc7
@@ -1274,7 +1274,7 @@ int virLXCProcessStart(virConnectPtr conn,
99cbc7
      * report implicit runtime defaults in the XML, like vnc listen/socket
99cbc7
      */
99cbc7
     VIR_DEBUG("Setting current domain def as transient");
99cbc7
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
99cbc7
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, NULL) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     /* Run an early hook to set-up missing devices */
99cbc7
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
99cbc7
index 3f8530eb0e..82371b9a66 100644
99cbc7
--- a/src/qemu/qemu_driver.c
99cbc7
+++ b/src/qemu/qemu_driver.c
99cbc7
@@ -8379,6 +8379,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
99cbc7
                                     const char *xml,
99cbc7
                                     unsigned int flags)
99cbc7
 {
99cbc7
+    qemuDomainObjPrivatePtr priv = vm->privateData;
99cbc7
     virDomainDefPtr vmdef = NULL;
99cbc7
     virQEMUDriverConfigPtr cfg = NULL;
99cbc7
     virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
99cbc7
@@ -8417,7 +8418,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, priv->qemuCaps);
99cbc7
         if (!vmdef)
99cbc7
             goto cleanup;
99cbc7
 
99cbc7
@@ -8520,6 +8521,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
99cbc7
 {
99cbc7
     virQEMUDriverPtr driver = dom->conn->privateData;
99cbc7
     virDomainObjPtr vm = NULL;
99cbc7
+    qemuDomainObjPrivatePtr priv;
99cbc7
     virDomainDefPtr vmdef = NULL;
99cbc7
     virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
99cbc7
     bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
99cbc7
@@ -8542,6 +8544,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
99cbc7
     if (!(vm = qemuDomObjFromDomain(dom)))
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
+    priv = vm->privateData;
99cbc7
+
99cbc7
     if (virDomainUpdateDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
@@ -8574,7 +8578,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt,
99cbc7
+                                              priv->qemuCaps);
99cbc7
         if (!vmdef)
99cbc7
             goto endjob;
99cbc7
 
99cbc7
@@ -8632,6 +8637,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
99cbc7
                                     const char *xml,
99cbc7
                                     unsigned int flags)
99cbc7
 {
99cbc7
+    qemuDomainObjPrivatePtr priv = vm->privateData;
99cbc7
     virCapsPtr caps = NULL;
99cbc7
     virQEMUDriverConfigPtr cfg = NULL;
99cbc7
     virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
99cbc7
@@ -8670,7 +8676,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
99cbc7
 
99cbc7
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
-        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
99cbc7
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt, priv->qemuCaps);
99cbc7
         if (!vmdef)
99cbc7
             goto cleanup;
99cbc7
 
99cbc7
@@ -8726,6 +8732,7 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver,
99cbc7
                                          const char *alias,
99cbc7
                                          unsigned int flags)
99cbc7
 {
99cbc7
+    qemuDomainObjPrivatePtr priv = vm->privateData;
99cbc7
     virCapsPtr caps = NULL;
99cbc7
     virQEMUDriverConfigPtr cfg = NULL;
99cbc7
     virDomainDefPtr def = NULL;
99cbc7
@@ -8752,7 +8759,8 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver,
99cbc7
     if (persistentDef) {
99cbc7
         virDomainDeviceDef dev;
99cbc7
 
99cbc7
-        if (!(vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt)))
99cbc7
+        if (!(vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt,
99cbc7
+                                                    priv->qemuCaps)))
99cbc7
             goto cleanup;
99cbc7
 
99cbc7
         if (virDomainDefFindDevice(vmdef, alias, &dev, true) < 0)
99cbc7
@@ -10368,7 +10376,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
99cbc7
     if (persistentDef) {
99cbc7
         /* Make a copy for updated domain. */
99cbc7
         if (!(persistentDefCopy = virDomainObjCopyPersistentDef(vm, caps,
99cbc7
-                                                                driver->xmlopt)))
99cbc7
+                                                                driver->xmlopt,
99cbc7
+                                                                priv->qemuCaps)))
99cbc7
             goto endjob;
99cbc7
     }
99cbc7
 
99cbc7
@@ -15975,6 +15984,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
99cbc7
     if (!(vm = qemuDomObjFromSnapshot(snapshot)))
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
+    priv = vm->privateData;
99cbc7
     cfg = virQEMUDriverGetConfig(driver);
99cbc7
 
99cbc7
     if (virDomainRevertToSnapshotEnsureACL(snapshot->domain->conn, vm->def) < 0)
99cbc7
@@ -16052,7 +16062,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
99cbc7
     snap->def->current = true;
99cbc7
     if (snap->def->dom) {
99cbc7
         config = virDomainDefCopy(snap->def->dom, caps,
99cbc7
-                                  driver->xmlopt, NULL, true);
99cbc7
+                                  driver->xmlopt, priv->qemuCaps, true);
99cbc7
         if (!config)
99cbc7
             goto endjob;
99cbc7
     }
99cbc7
@@ -16062,7 +16072,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
99cbc7
     switch ((virDomainState) snap->def->state) {
99cbc7
     case VIR_DOMAIN_RUNNING:
99cbc7
     case VIR_DOMAIN_PAUSED:
99cbc7
-        priv = vm->privateData;
99cbc7
         start_flags |= VIR_QEMU_PROCESS_START_PAUSED;
99cbc7
 
99cbc7
         /* Transitions 2, 3, 5, 6, 8, 9 */
99cbc7
@@ -20500,6 +20509,7 @@ qemuDomainGetFSInfo(virDomainPtr dom,
99cbc7
                     unsigned int flags)
99cbc7
 {
99cbc7
     virQEMUDriverPtr driver = dom->conn->privateData;
99cbc7
+    qemuDomainObjPrivatePtr priv;
99cbc7
     virDomainObjPtr vm;
99cbc7
     qemuAgentPtr agent;
99cbc7
     virCapsPtr caps = NULL;
99cbc7
@@ -20511,6 +20521,8 @@ qemuDomainGetFSInfo(virDomainPtr dom,
99cbc7
     if (!(vm = qemuDomObjFromDomain(dom)))
99cbc7
         return ret;
99cbc7
 
99cbc7
+    priv = vm->privateData;
99cbc7
+
99cbc7
     if (virDomainGetFSInfoEnsureACL(dom->conn, vm->def) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
@@ -20526,7 +20538,7 @@ qemuDomainGetFSInfo(virDomainPtr dom,
99cbc7
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
99cbc7
         goto endjob;
99cbc7
 
99cbc7
-    if (!(def = virDomainDefCopy(vm->def, caps, driver->xmlopt, NULL, false)))
99cbc7
+    if (!(def = virDomainDefCopy(vm->def, caps, driver->xmlopt, priv->qemuCaps, false)))
99cbc7
         goto endjob;
99cbc7
 
99cbc7
     agent = qemuDomainObjEnterAgent(vm);
99cbc7
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
99cbc7
index f5d77d2508..b7f4110baf 100644
99cbc7
--- a/src/qemu/qemu_migration.c
99cbc7
+++ b/src/qemu/qemu_migration.c
99cbc7
@@ -4850,6 +4850,7 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
99cbc7
                         bool ignoreSaveError)
99cbc7
 {
99cbc7
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
99cbc7
+    qemuDomainObjPrivatePtr priv = vm->privateData;
99cbc7
     virCapsPtr caps = NULL;
99cbc7
     virDomainDefPtr vmdef;
99cbc7
     virDomainDefPtr oldDef = NULL;
99cbc7
@@ -4864,7 +4865,8 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
99cbc7
     oldDef = vm->newDef;
99cbc7
     vm->newDef = qemuMigrationCookieGetPersistent(mig);
99cbc7
 
99cbc7
-    if (!(vmdef = virDomainObjGetPersistentDef(caps, driver->xmlopt, vm)))
99cbc7
+    if (!(vmdef = virDomainObjGetPersistentDef(caps, driver->xmlopt, vm,
99cbc7
+                                               priv->qemuCaps)))
99cbc7
         goto error;
99cbc7
 
99cbc7
     if (virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0 &&
99cbc7
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
99cbc7
index 34686b4d92..08e1d91fcc 100644
99cbc7
--- a/src/qemu/qemu_process.c
99cbc7
+++ b/src/qemu/qemu_process.c
99cbc7
@@ -5375,7 +5375,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
99cbc7
      * report implicit runtime defaults in the XML, like vnc listen/socket
99cbc7
      */
99cbc7
     VIR_DEBUG("Setting current domain def as transient");
99cbc7
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
99cbc7
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, priv->qemuCaps) < 0)
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     if (flags & VIR_QEMU_PROCESS_START_PRETEND) {
99cbc7
@@ -7314,7 +7314,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
99cbc7
      * report implicit runtime defaults in the XML, like vnc listen/socket
99cbc7
      */
99cbc7
     VIR_DEBUG("Setting current domain def as transient");
99cbc7
-    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0)
99cbc7
+    if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm, NULL) < 0)
99cbc7
         goto error;
99cbc7
 
99cbc7
     vm->def->id = qemuDriverAllocateID(driver);
99cbc7
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
99cbc7
index 5494d51017..1a25b37729 100644
99cbc7
--- a/src/test/test_driver.c
99cbc7
+++ b/src/test/test_driver.c
99cbc7
@@ -657,7 +657,7 @@ testDomainStartState(testDriverPtr privconn,
99cbc7
 
99cbc7
     if (virDomainObjSetDefTransient(privconn->caps,
99cbc7
                                     privconn->xmlopt,
99cbc7
-                                    dom) < 0) {
99cbc7
+                                    dom, NULL) < 0) {
99cbc7
         goto cleanup;
99cbc7
     }
99cbc7
 
99cbc7
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
99cbc7
index c77988f01e..796de53d43 100644
99cbc7
--- a/src/uml/uml_driver.c
99cbc7
+++ b/src/uml/uml_driver.c
99cbc7
@@ -1092,7 +1092,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
99cbc7
      * report implicit runtime defaults in the XML, like vnc listen/socket
99cbc7
      */
99cbc7
     VIR_DEBUG("Setting current domain def as transient");
99cbc7
-    if (virDomainObjSetDefTransient(driver->caps, driver->xmlopt, vm) < 0) {
99cbc7
+    if (virDomainObjSetDefTransient(driver->caps, driver->xmlopt, vm, NULL) < 0) {
99cbc7
         VIR_FORCE_CLOSE(logfd);
99cbc7
         return -1;
99cbc7
     }
99cbc7
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
99cbc7
index bc199685c6..2dbf768e16 100644
99cbc7
--- a/tests/qemuhotplugtest.c
99cbc7
+++ b/tests/qemuhotplugtest.c
99cbc7
@@ -425,7 +425,7 @@ testQemuHotplugCpuPrepare(const char *test,
99cbc7
 
99cbc7
     /* create vm->newDef */
99cbc7
     data->vm->persistent = true;
99cbc7
-    if (virDomainObjSetDefTransient(caps, driver.xmlopt, data->vm) < 0)
99cbc7
+    if (virDomainObjSetDefTransient(caps, driver.xmlopt, data->vm, NULL) < 0)
99cbc7
         goto error;
99cbc7
 
99cbc7
     priv = data->vm->privateData;
99cbc7
-- 
99cbc7
2.22.1
99cbc7