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

[libvirt] [PATCH v5.1 03/11] conf callback: Rearrange function parameters



Move the xmlopt and caps arguments to the end of the argument list.
---
 src/conf/domain_conf.c           | 106 +++++++++++++++++++--------------------
 src/conf/domain_conf.h           |  44 ++++++++--------
 src/conf/snapshot_conf.c         |   2 +-
 src/esx/esx_driver.c             |   8 +--
 src/libxl/libxl_driver.c         |  55 ++++++++++----------
 src/lxc/lxc_controller.c         |   4 +-
 src/lxc/lxc_driver.c             |  43 ++++++++--------
 src/openvz/openvz_conf.c         |   2 +-
 src/openvz/openvz_driver.c       |  18 +++----
 src/parallels/parallels_driver.c |  12 ++---
 src/phyp/phyp_driver.c           |   9 ++--
 src/qemu/qemu_driver.c           |  68 ++++++++++++-------------
 src/qemu/qemu_migration.c        |  13 +++--
 src/security/virt-aa-helper.c    |   6 +--
 src/test/test_driver.c           |  36 ++++++-------
 src/uml/uml_driver.c             |  30 ++++++-----
 src/vbox/vbox_tmpl.c             |  12 ++---
 src/vmware/vmware_conf.c         |   4 +-
 src/vmware/vmware_driver.c       |  12 ++---
 src/xen/xen_driver.c             |   4 +-
 src/xen/xend_internal.c          |  20 ++++----
 src/xen/xm_internal.c            |  14 +++---
 src/xenapi/xenapi_driver.c       |   8 +--
 tests/lxcxml2xmltest.c           |   2 +-
 tests/qemuxml2argvtest.c         |   2 +-
 tests/qemuxml2xmltest.c          |   2 +-
 tests/qemuxmlnstest.c            |   2 +-
 tests/securityselinuxlabeltest.c |   2 +-
 tests/xmconfigtest.c             |   2 +-
 tests/xml2sexprtest.c            |   2 +-
 tests/xml2vmxtest.c              |   2 +-
 31 files changed, 270 insertions(+), 276 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a13a871..ca2b805 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2000,8 +2000,8 @@ void virDomainObjAssignDef(virDomainObjPtr domain,
  */
 static virDomainObjPtr
 virDomainObjListAddLocked(virDomainObjListPtr doms,
-                          virDomainXMLOptionPtr xmlopt,
                           const virDomainDefPtr def,
+                          virDomainXMLOptionPtr xmlopt,
                           unsigned int flags,
                           virDomainDefPtr *oldDef)
 {
@@ -2071,15 +2071,15 @@ error:


 virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
-                                    virDomainXMLOptionPtr xmlopt,
                                     const virDomainDefPtr def,
+                                    virDomainXMLOptionPtr xmlopt,
                                     unsigned int flags,
                                     virDomainDefPtr *oldDef)
 {
     virDomainObjPtr ret;

     virObjectLock(doms);
-    ret = virDomainObjListAddLocked(doms, xmlopt, def, flags, oldDef);
+    ret = virDomainObjListAddLocked(doms, def, xmlopt, flags, oldDef);
     virObjectUnlock(doms);
     return ret;
 }
@@ -2113,7 +2113,7 @@ virDomainObjSetDefTransient(virCapsPtr caps,
     if (domain->newDef)
         return 0;

-    if (!(domain->newDef = virDomainDefCopy(caps, xmlopt, domain->def, false)))
+    if (!(domain->newDef = virDomainDefCopy(domain->def, caps, xmlopt, false)))
         goto out;

     ret = 0;
@@ -8470,10 +8470,10 @@ virDomainPMStateParseXML(xmlXPathContextPtr ctxt,
 }

 virDomainDeviceDefPtr
-virDomainDeviceDefParse(virCapsPtr caps,
-                        virDomainXMLOptionPtr xmlopt,
+virDomainDeviceDefParse(const char *xmlStr,
                         virDomainDefPtr def,
-                        const char *xmlStr,
+                        virCapsPtr caps,
+                        virDomainXMLOptionPtr xmlopt,
                         unsigned int flags)
 {
     xmlDocPtr xml;
@@ -9469,11 +9469,11 @@ cleanup:


 static virDomainDefPtr
-virDomainDefParseXML(virCapsPtr caps,
-                     virDomainXMLOptionPtr xmlopt,
-                     xmlDocPtr xml,
+virDomainDefParseXML(xmlDocPtr xml,
                      xmlNodePtr root,
                      xmlXPathContextPtr ctxt,
+                     virCapsPtr caps,
+                     virDomainXMLOptionPtr xmlopt,
                      unsigned int expectedVirtTypes,
                      unsigned int flags)
 {
@@ -11139,10 +11139,10 @@ error:


 static virDomainObjPtr
-virDomainObjParseXML(virCapsPtr caps,
-                     virDomainXMLOptionPtr xmlopt,
-                     xmlDocPtr xml,
+virDomainObjParseXML(xmlDocPtr xml,
                      xmlXPathContextPtr ctxt,
+                     virCapsPtr caps,
+                     virDomainXMLOptionPtr xmlopt,
                      unsigned int expectedVirtTypes,
                      unsigned int flags)
 {
@@ -11167,8 +11167,8 @@ virDomainObjParseXML(virCapsPtr caps,

     oldnode = ctxt->node;
     ctxt->node = config;
-    obj->def = virDomainDefParseXML(caps, xmlopt, xml, config, ctxt, expectedVirtTypes,
-                                    flags);
+    obj->def = virDomainDefParseXML(xml, config, ctxt, caps, xmlopt,
+                                    expectedVirtTypes, flags);
     ctxt->node = oldnode;
     if (!obj->def)
         goto error;
@@ -11250,8 +11250,8 @@ virDomainDefParse(const char *xmlStr,
     int keepBlanksDefault = xmlKeepBlanksDefault(0);

     if ((xml = virXMLParse(filename, xmlStr, _("(domain_definition)")))) {
-        def = virDomainDefParseNode(caps, xmlopt, xml, xmlDocGetRootElement(xml),
-                                    expectedVirtTypes, flags);
+        def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
+                                    xmlopt, expectedVirtTypes, flags);
         xmlFreeDoc(xml);
     }

@@ -11260,9 +11260,9 @@ virDomainDefParse(const char *xmlStr,
 }

 virDomainDefPtr
-virDomainDefParseString(virCapsPtr caps,
+virDomainDefParseString(const char *xmlStr,
+                        virCapsPtr caps,
                         virDomainXMLOptionPtr xmlopt,
-                        const char *xmlStr,
                         unsigned int expectedVirtTypes,
                         unsigned int flags)
 {
@@ -11271,9 +11271,9 @@ virDomainDefParseString(virCapsPtr caps,
 }

 virDomainDefPtr
-virDomainDefParseFile(virCapsPtr caps,
+virDomainDefParseFile(const char *filename,
+                      virCapsPtr caps,
                       virDomainXMLOptionPtr xmlopt,
-                      const char *filename,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11283,10 +11283,10 @@ virDomainDefParseFile(virCapsPtr caps,


 virDomainDefPtr
-virDomainDefParseNode(virCapsPtr caps,
-                      virDomainXMLOptionPtr xmlopt,
-                      xmlDocPtr xml,
+virDomainDefParseNode(xmlDocPtr xml,
                       xmlNodePtr root,
+                      virCapsPtr caps,
+                      virDomainXMLOptionPtr xmlopt,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11308,7 +11308,7 @@ virDomainDefParseNode(virCapsPtr caps,
     }

     ctxt->node = root;
-    def = virDomainDefParseXML(caps, xmlopt, xml, root, ctxt,
+    def = virDomainDefParseXML(xml, root, ctxt, caps, xmlopt,
                                expectedVirtTypes, flags);

 cleanup:
@@ -11318,10 +11318,10 @@ cleanup:


 static virDomainObjPtr
-virDomainObjParseNode(virCapsPtr caps,
-                      virDomainXMLOptionPtr xmlopt,
-                      xmlDocPtr xml,
+virDomainObjParseNode(xmlDocPtr xml,
                       xmlNodePtr root,
+                      virCapsPtr caps,
+                      virDomainXMLOptionPtr xmlopt,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11342,7 +11342,7 @@ virDomainObjParseNode(virCapsPtr caps,
     }

     ctxt->node = root;
-    obj = virDomainObjParseXML(caps, xmlopt, xml, ctxt, expectedVirtTypes, flags);
+    obj = virDomainObjParseXML(xml, ctxt, caps, xmlopt, expectedVirtTypes, flags);

 cleanup:
     xmlXPathFreeContext(ctxt);
@@ -11351,9 +11351,9 @@ cleanup:


 static virDomainObjPtr
-virDomainObjParseFile(virCapsPtr caps,
+virDomainObjParseFile(const char *filename,
+                      virCapsPtr caps,
                       virDomainXMLOptionPtr xmlopt,
-                      const char *filename,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11362,8 +11362,8 @@ virDomainObjParseFile(virCapsPtr caps,
     int keepBlanksDefault = xmlKeepBlanksDefault(0);

     if ((xml = virXMLParseFile(filename))) {
-        obj = virDomainObjParseNode(caps, xmlopt, xml,
-                                    xmlDocGetRootElement(xml),
+        obj = virDomainObjParseNode(xml, xmlDocGetRootElement(xml),
+                                    caps, xmlopt,
                                     expectedVirtTypes, flags);
         xmlFreeDoc(xml);
     }
@@ -15526,7 +15526,7 @@ virDomainObjListLoadConfig(virDomainObjListPtr doms,

     if ((configFile = virDomainConfigFile(configDir, name)) == NULL)
         goto error;
-    if (!(def = virDomainDefParseFile(caps, xmlopt, configFile,
+    if (!(def = virDomainDefParseFile(configFile, caps, xmlopt,
                                       expectedVirtTypes,
                                       VIR_DOMAIN_XML_INACTIVE)))
         goto error;
@@ -15537,7 +15537,7 @@ virDomainObjListLoadConfig(virDomainObjListPtr doms,
     if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
         goto error;

-    if (!(dom = virDomainObjListAddLocked(doms, xmlopt, def, 0, &oldDef)))
+    if (!(dom = virDomainObjListAddLocked(doms, def, xmlopt, 0, &oldDef)))
         goto error;

     dom->autostart = autostart;
@@ -15559,10 +15559,10 @@ error:

 static virDomainObjPtr
 virDomainObjListLoadStatus(virDomainObjListPtr doms,
-                           virCapsPtr caps,
-                           virDomainXMLOptionPtr xmlopt,
                            const char *statusDir,
                            const char *name,
+                           virCapsPtr caps,
+                           virDomainXMLOptionPtr xmlopt,
                            unsigned int expectedVirtTypes,
                            virDomainLoadConfigNotify notify,
                            void *opaque)
@@ -15574,7 +15574,7 @@ virDomainObjListLoadStatus(virDomainObjListPtr doms,
     if ((statusFile = virDomainConfigFile(statusDir, name)) == NULL)
         goto error;

-    if (!(obj = virDomainObjParseFile(caps, xmlopt, statusFile, expectedVirtTypes,
+    if (!(obj = virDomainObjParseFile(statusFile, caps, xmlopt, expectedVirtTypes,
                                       VIR_DOMAIN_XML_INTERNAL_STATUS |
                                       VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
                                       VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES)))
@@ -15606,11 +15606,11 @@ error:

 int
 virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
-                               virCapsPtr caps,
-                               virDomainXMLOptionPtr xmlopt,
                                const char *configDir,
                                const char *autostartDir,
                                int liveStatus,
+                               virCapsPtr caps,
+                               virDomainXMLOptionPtr xmlopt,
                                unsigned int expectedVirtTypes,
                                virDomainLoadConfigNotify notify,
                                void *opaque)
@@ -15645,10 +15645,10 @@ virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
         VIR_INFO("Loading config file '%s.xml'", entry->d_name);
         if (liveStatus)
             dom = virDomainObjListLoadStatus(doms,
-                                             caps,
-                                             xmlopt,
                                              configDir,
                                              entry->d_name,
+                                             caps,
+                                             xmlopt,
                                              expectedVirtTypes,
                                              notify,
                                              opaque);
@@ -16048,9 +16048,9 @@ cleanup:
  * persistent and active, true for transitions across save files or
  * snapshots).  */
 virDomainDefPtr
-virDomainDefCopy(virCapsPtr caps,
+virDomainDefCopy(virDomainDefPtr src,
+                 virCapsPtr caps,
                  virDomainXMLOptionPtr xmlopt,
-                 virDomainDefPtr src,
                  bool migratable)
 {
     char *xml;
@@ -16065,21 +16065,21 @@ virDomainDefCopy(virCapsPtr caps,
     if (!(xml = virDomainDefFormat(src, write_flags)))
         return NULL;

-    ret = virDomainDefParseString(caps, xmlopt, xml, -1, read_flags);
+    ret = virDomainDefParseString(xml, caps, xmlopt, -1, read_flags);

     VIR_FREE(xml);
     return ret;
 }

 virDomainDefPtr
-virDomainObjCopyPersistentDef(virCapsPtr caps,
-                              virDomainXMLOptionPtr xmlopt,
-                              virDomainObjPtr dom)
+virDomainObjCopyPersistentDef(virDomainObjPtr dom,
+                              virCapsPtr caps,
+                              virDomainXMLOptionPtr xmlopt)
 {
     virDomainDefPtr cur;

     cur = virDomainObjGetPersistentDef(caps, xmlopt, dom);
-    return virDomainDefCopy(caps, xmlopt, cur, false);
+    return virDomainDefCopy(cur, caps, xmlopt, false);
 }


@@ -16519,10 +16519,10 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
  * Returns a pointer to copied @src or NULL in case of error.
  */
 virDomainDeviceDefPtr
-virDomainDeviceDefCopy(virCapsPtr caps,
-                       virDomainXMLOptionPtr xmlopt,
+virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
                        const virDomainDefPtr def,
-                       virDomainDeviceDefPtr src)
+                       virCapsPtr caps,
+                       virDomainXMLOptionPtr xmlopt)
 {
     virDomainDeviceDefPtr ret = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -16589,7 +16589,7 @@ virDomainDeviceDefCopy(virCapsPtr caps,
         goto cleanup;

     xmlStr = virBufferContentAndReset(&buf);
-    ret = virDomainDeviceDefParse(caps, xmlopt, def, xmlStr, flags);
+    ret = virDomainDeviceDefParse(xmlStr, def, caps, xmlopt, flags);

 cleanup:
     VIR_FREE(xmlStr);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 69a468a..e54dadc 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2026,10 +2026,10 @@ void virDomainHubDefFree(virDomainHubDefPtr def);
 void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
 void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
 void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
-virDomainDeviceDefPtr virDomainDeviceDefCopy(virCapsPtr caps,
-                                             virDomainXMLOptionPtr xmlopt,
+virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
                                              const virDomainDefPtr def,
-                                             virDomainDeviceDefPtr src);
+                                             virCapsPtr caps,
+                                             virDomainXMLOptionPtr xmlopt);
 int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
                                   int type);
 int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
@@ -2057,8 +2057,8 @@ enum {
     VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
 };
 virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
-                                    virDomainXMLOptionPtr xmlopt,
                                     const virDomainDefPtr def,
+                                    virDomainXMLOptionPtr xmlopt,
                                     unsigned int flags,
                                     virDomainDefPtr *oldDef);
 void virDomainObjAssignDef(virDomainObjPtr domain,
@@ -2081,34 +2081,36 @@ virDomainLiveConfigHelperMethod(virCapsPtr caps,
                                 unsigned int *flags,
                                 virDomainDefPtr *persistentDef);

-virDomainDefPtr virDomainDefCopy(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
-                                 virDomainDefPtr src, bool migratable);
-virDomainDefPtr
-virDomainObjCopyPersistentDef(virCapsPtr caps, virDomainXMLOptionPtr xmlopt,
-                              virDomainObjPtr dom);
+virDomainDefPtr virDomainDefCopy(virDomainDefPtr src,
+                                 virCapsPtr caps,
+                                 virDomainXMLOptionPtr xmlopt,
+                                 bool migratable);
+virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
+                                              virCapsPtr caps,
+                                              virDomainXMLOptionPtr xmlopt);

 void virDomainObjListRemove(virDomainObjListPtr doms,
                             virDomainObjPtr dom);

-virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
-                                              virDomainXMLOptionPtr xmlopt,
+virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
                                               virDomainDefPtr def,
-                                              const char *xmlStr,
+                                              virCapsPtr caps,
+                                              virDomainXMLOptionPtr xmlopt,
                                               unsigned int flags);
-virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
+virDomainDefPtr virDomainDefParseString(const char *xmlStr,
+                                        virCapsPtr caps,
                                         virDomainXMLOptionPtr xmlopt,
-                                        const char *xmlStr,
                                         unsigned int expectedVirtTypes,
                                         unsigned int flags);
-virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
+virDomainDefPtr virDomainDefParseFile(const char *filename,
+                                      virCapsPtr caps,
                                       virDomainXMLOptionPtr xmlopt,
-                                      const char *filename,
                                       unsigned int expectedVirtTypes,
                                       unsigned int flags);
-virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
-                                      virDomainXMLOptionPtr xmlopt,
-                                      xmlDocPtr doc,
+virDomainDefPtr virDomainDefParseNode(xmlDocPtr doc,
                                       xmlNodePtr root,
+                                      virCapsPtr caps,
+                                      virDomainXMLOptionPtr xmlopt,
                                       unsigned int expectedVirtTypes,
                                       unsigned int flags);

@@ -2232,11 +2234,11 @@ typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                           void *opaque);

 int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
-                                   virCapsPtr caps,
-                                   virDomainXMLOptionPtr xmlopt,
                                    const char *configDir,
                                    const char *autostartDir,
                                    int liveStatus,
+                                   virCapsPtr caps,
+                                   virDomainXMLOptionPtr xmlopt,
                                    unsigned int expectedVirtTypes,
                                    virDomainLoadConfigNotify notify,
                                    void *opaque);
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 3a3173f..bd5684d 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -264,7 +264,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
                                _("missing domain in snapshot"));
                 goto cleanup;
             }
-            def->dom = virDomainDefParseNode(caps, xmlopt, xml, domainNode,
+            def->dom = virDomainDefParseNode(xml, domainNode, caps, xmlopt,
                                              expectedVirtTypes,
                                              (VIR_DOMAIN_XML_INACTIVE |
                                               VIR_DOMAIN_XML_SECURE));
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 1335ee6..08381fc 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2887,8 +2887,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
         return NULL;
     }

-    def = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                  domainXml, 1 << VIR_DOMAIN_VIRT_VMWARE, 0);
+    def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt,
+                                  1 << VIR_DOMAIN_VIRT_VMWARE, 0);

     if (def == NULL) {
         return NULL;
@@ -3103,8 +3103,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
     }

     /* Parse domain XML */
-    def = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                  xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
+                                  1 << VIR_DOMAIN_VIRT_VMWARE,
                                   VIR_DOMAIN_XML_INACTIVE);

     if (def == NULL) {
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4015389..bf682c5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -563,8 +563,8 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from,
         goto error;
     }

-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto error;

@@ -1246,11 +1246,12 @@ libxlStartup(bool privileged,

     /* Load running domains first. */
     if (virDomainObjListLoadAllConfigs(libxl_driver->domains,
-                                       libxl_driver->caps,
-                                       libxl_driver->xmlopt,
                                        libxl_driver->stateDir,
                                        libxl_driver->autostartDir,
-                                       1, 1 << VIR_DOMAIN_VIRT_XEN,
+                                       1,
+                                       libxl_driver->caps,
+                                       libxl_driver->xmlopt,
+                                       1 << VIR_DOMAIN_VIRT_XEN,
                                        NULL, NULL) < 0)
         goto error;

@@ -1258,11 +1259,12 @@ libxlStartup(bool privileged,

     /* Then inactive persistent configs */
     if (virDomainObjListLoadAllConfigs(libxl_driver->domains,
-                                       libxl_driver->caps,
-                                       libxl_driver->xmlopt,
                                        libxl_driver->configDir,
                                        libxl_driver->autostartDir,
-                                       0, 1 << VIR_DOMAIN_VIRT_XEN,
+                                       0,
+                                       libxl_driver->caps,
+                                       libxl_driver->xmlopt,
+                                       1 << VIR_DOMAIN_VIRT_XEN,
                                        NULL, NULL) < 0)
         goto error;

@@ -1296,11 +1298,12 @@ libxlReload(void)

     libxlDriverLock(libxl_driver);
     virDomainObjListLoadAllConfigs(libxl_driver->domains,
-                                   libxl_driver->caps,
-                                   libxl_driver->xmlopt,
                                    libxl_driver->configDir,
                                    libxl_driver->autostartDir,
-                                   1, 1 << VIR_DOMAIN_VIRT_XEN,
+                                   1,
+                                   libxl_driver->caps,
+                                   libxl_driver->xmlopt,
+                                   1 << VIR_DOMAIN_VIRT_XEN,
                                    NULL, libxl_driver);

     virDomainObjListForEach(libxl_driver->domains, libxlAutostartDomain,
@@ -1455,14 +1458,13 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
     virCheckFlags(VIR_DOMAIN_START_PAUSED, NULL);

     libxlDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -2242,9 +2244,8 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
     if (fd < 0)
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
@@ -2932,7 +2933,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
         goto cleanup;
     }

-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt, domainXml,
+    if (!(def = virDomainDefParseString(domainXml,
+                                        driver->caps, driver->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_XEN, 0)))
         goto cleanup;

@@ -3034,14 +3036,13 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
     virDomainDefPtr oldDef = NULL;

     libxlDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    0,
                                    &oldDef)))
         goto cleanup;
@@ -3557,14 +3558,14 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
     priv = vm->privateData;

     if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
-        if (!(dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
-                                            vm->def, xml,
+        if (!(dev = virDomainDeviceDefParse(xml, vm->def,
+                                            driver->caps, driver->xmlopt,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;

         /* Make a copy for updated domain. */
-        if (!(vmdef = virDomainObjCopyPersistentDef(driver->caps,
-                                                    driver->xmlopt, vm)))
+        if (!(vmdef = virDomainObjCopyPersistentDef(vm, driver->caps,
+                                                    driver->xmlopt)))
             goto cleanup;

         switch (action) {
@@ -3588,8 +3589,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
     if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
         /* If dev exists it was created to modify the domain config. Free it. */
         virDomainDeviceDefFree(dev);
-        if (!(dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
-                                            vm->def, xml,
+        if (!(dev = virDomainDeviceDefParse(xml, vm->def,
+                                            driver->caps, driver->xmlopt,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 440a183..ed73fa1 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -169,8 +169,8 @@ static virLXCControllerPtr virLXCControllerNew(const char *name)
                                           ctrl->name)) == NULL)
         goto error;

-    if ((ctrl->def = virDomainDefParseFile(caps, xmlopt,
-                                           configFile,
+    if ((ctrl->def = virDomainDefParseFile(configFile,
+                                           caps, xmlopt,
                                            1 << VIR_DOMAIN_VIRT_LXC,
                                            0)) == NULL)
         goto error;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 572329d..8afa664 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -413,7 +413,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
     virDomainDefPtr oldDef = NULL;

     lxcDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_LXC,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
@@ -427,11 +427,9 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
         goto cleanup;
     }

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
-                                   0,
-                                   &oldDef)))
+                                   0, &oldDef)))
         goto cleanup;
     def = NULL;
     vm->persistent = 1;
@@ -1069,7 +1067,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
     virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, NULL);

     lxcDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_LXC,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
@@ -1084,9 +1082,8 @@ lxcDomainCreateAndStart(virConnectPtr conn,
     }


-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -1491,11 +1488,11 @@ static int lxcStartup(bool privileged,

     /* Get all the running persistent or transient configs first */
     if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
+                                       lxc_driver->stateDir,
+                                       NULL, 1,
                                        lxc_driver->caps,
                                        lxc_driver->xmlopt,
-                                       lxc_driver->stateDir,
-                                       NULL,
-                                       1, 1 << VIR_DOMAIN_VIRT_LXC,
+                                       1 << VIR_DOMAIN_VIRT_LXC,
                                        NULL, NULL) < 0)
         goto cleanup;

@@ -1503,11 +1500,11 @@ static int lxcStartup(bool privileged,

     /* Then inactive persistent configs */
     if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
+                                       lxc_driver->configDir,
+                                       lxc_driver->autostartDir, 0,
                                        lxc_driver->caps,
                                        lxc_driver->xmlopt,
-                                       lxc_driver->configDir,
-                                       lxc_driver->autostartDir,
-                                       0, 1 << VIR_DOMAIN_VIRT_LXC,
+                                       1 << VIR_DOMAIN_VIRT_LXC,
                                        NULL, NULL) < 0)
         goto cleanup;

@@ -1551,11 +1548,11 @@ lxcReload(void) {

     lxcDriverLock(lxc_driver);
     virDomainObjListLoadAllConfigs(lxc_driver->domains,
+                                   lxc_driver->configDir,
+                                   lxc_driver->autostartDir, 0,
                                    lxc_driver->caps,
                                    lxc_driver->xmlopt,
-                                   lxc_driver->configDir,
-                                   lxc_driver->autostartDir,
-                                   0, 1 << VIR_DOMAIN_VIRT_LXC,
+                                   1 << VIR_DOMAIN_VIRT_LXC,
                                    lxcNotifyLoadDomain, lxc_driver);
     lxcDriverUnlock(lxc_driver);

@@ -1805,7 +1802,7 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,

     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         /* Make a copy for updated domain. */
-        vmdef = virDomainObjCopyPersistentDef(driver->caps, driver->xmlopt, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, driver->caps, driver->xmlopt);
         if (!vmdef)
             goto cleanup;
     }
@@ -4360,8 +4357,8 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          goto cleanup;
     }

-    dev = dev_copy = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
-                                             vm->def, xml,
+    dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
+                                             driver->caps, driver->xmlopt,
                                              VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;
@@ -4372,8 +4369,8 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          * create a deep copy of device as adding
          * to CONFIG takes one instance.
          */
-        dev_copy = virDomainDeviceDefCopy(driver->caps, driver->xmlopt,
-                                          vm->def, dev);
+        dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                          driver->caps, driver->xmlopt);
         if (!dev_copy)
             goto cleanup;
     }
@@ -4383,7 +4380,7 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             goto cleanup;

         /* Make a copy for updated domain. */
-        vmdef = virDomainObjCopyPersistentDef(driver->caps, driver->xmlopt, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, driver->caps, driver->xmlopt);
         if (!vmdef)
             goto cleanup;
         switch (action) {
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 3cd27a4..3b0731b 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -650,8 +650,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
             flags |= VIR_DOMAIN_OBJ_LIST_ADD_LIVE;

         if (!(dom = virDomainObjListAdd(driver->domains,
-                                        driver->xmlopt,
                                         def,
+                                        driver->xmlopt,
                                         flags,
                                         NULL)))
             goto cleanup;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index d334486..9b1919a 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -955,8 +955,8 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
     virDomainPtr dom = NULL;

     openvzDriverLock(driver);
-    if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                         xml, 1 << VIR_DOMAIN_VIRT_OPENVZ,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                         1 << VIR_DOMAIN_VIRT_OPENVZ,
                                          VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

@@ -967,9 +967,9 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
                        vmdef->name);
         goto cleanup;
     }
-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
                                    driver->xmlopt,
-                                   vmdef, 0, NULL)))
+                                   0, NULL)))
         goto cleanup;
     vmdef = NULL;
     vm->persistent = 1;
@@ -1042,8 +1042,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
     virCheckFlags(0, NULL);

     openvzDriverLock(driver);
-    if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                         xml, 1 << VIR_DOMAIN_VIRT_OPENVZ,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                         1 << VIR_DOMAIN_VIRT_OPENVZ,
                                          VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

@@ -1055,8 +1055,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
         goto cleanup;
     }
     if (!(vm = virDomainObjListAdd(driver->domains,
-                                   driver->xmlopt,
                                    vmdef,
+                                   driver->xmlopt,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -2085,8 +2085,8 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
                                         &vmdef) < 0)
         goto cleanup;

-    dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt,
-                                  vmdef, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, vmdef, driver->caps, driver->xmlopt,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (!dev)
         goto cleanup;

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 5d5353a..7de9cc0 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -830,9 +830,9 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
     if (parallelsAddVNCInfo(def, jobj) < 0)
         goto cleanup;

-    if (!(dom = virDomainObjListAdd(privconn->domains,
+    if (!(dom = virDomainObjListAdd(privconn->domains, def,
                                     privconn->xmlopt,
-                                    def, 0, NULL)))
+                                    0, NULL)))
         goto cleanup;
     /* dom is locked here */

@@ -2330,8 +2330,8 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
     virDomainObjPtr dom = NULL, olddom = NULL;

     parallelsDriverLock(privconn);
-    if ((def = virDomainDefParseString(privconn->caps, privconn->xmlopt,
-                                       xml, 1 << VIR_DOMAIN_VIRT_PARALLELS,
+    if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
+                                       1 << VIR_DOMAIN_VIRT_PARALLELS,
                                        VIR_DOMAIN_XML_INACTIVE)) == NULL) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Can't parse XML desc"));
@@ -2369,9 +2369,9 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
     }
     virObjectUnlock(olddom);

-    if (!(dom = virDomainObjListAdd(privconn->domains,
+    if (!(dom = virDomainObjListAdd(privconn->domains, def,
                                     privconn->xmlopt,
-                                    def, 0, NULL))) {
+                                    0, NULL))) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Can't allocate domobj"));
         goto cleanup;
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index cd9a989..8716d4d 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1754,8 +1754,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
         goto cleanup;
     }

-    dev = virDomainDeviceDefParse(phyp_driver->caps, NULL,
-                                  def, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (!dev) {
         goto cleanup;
     }
@@ -3637,8 +3637,9 @@ phypDomainCreateAndStart(virConnectPtr conn,

     virCheckFlags(0, NULL);

-    if (!(def = virDomainDefParseString(phyp_driver->caps, phyp_driver->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_PHYP,
+    if (!(def = virDomainDefParseString(xml, phyp_driver->caps,
+                                        phyp_driver->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_PHYP,
                                         VIR_DOMAIN_XML_SECURE)))
         goto err;

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d3276de..1215fec 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -766,11 +766,11 @@ qemuStartup(bool privileged,

     /* Get all the running persistent or transient configs first */
     if (virDomainObjListLoadAllConfigs(qemu_driver->domains,
+                                       cfg->stateDir,
+                                       NULL, 1,
                                        qemu_driver->caps,
                                        qemu_driver->xmlopt,
-                                       cfg->stateDir,
-                                       NULL,
-                                       1, QEMU_EXPECTED_VIRT_TYPES,
+                                       QEMU_EXPECTED_VIRT_TYPES,
                                        NULL, NULL) < 0)
         goto error;

@@ -791,11 +791,11 @@ qemuStartup(bool privileged,

     /* Then inactive persistent configs */
     if (virDomainObjListLoadAllConfigs(qemu_driver->domains,
+                                       cfg->configDir,
+                                       cfg->autostartDir, 0,
                                        qemu_driver->caps,
                                        qemu_driver->xmlopt,
-                                       cfg->configDir,
-                                       cfg->autostartDir,
-                                       0, QEMU_EXPECTED_VIRT_TYPES,
+                                       QEMU_EXPECTED_VIRT_TYPES,
                                        NULL, NULL) < 0)
         goto error;

@@ -865,11 +865,10 @@ qemuReload(void) {

     cfg = virQEMUDriverGetConfig(qemu_driver);
     virDomainObjListLoadAllConfigs(qemu_driver->domains,
-                                   caps,
-                                   qemu_driver->xmlopt,
                                    cfg->configDir,
-                                   cfg->autostartDir,
-                                   0, QEMU_EXPECTED_VIRT_TYPES,
+                                   cfg->autostartDir, 0,
+                                   caps, qemu_driver->xmlopt,
+                                   QEMU_EXPECTED_VIRT_TYPES,
                                    qemuNotifyLoadDomain, qemu_driver);
 cleanup:
     virObjectUnref(cfg);
@@ -1486,7 +1485,7 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml,
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;

-    if (!(def = virDomainDefParseString(caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
@@ -1503,9 +1502,8 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml,
     if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -2855,7 +2853,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
     if (xmlin) {
         virDomainDefPtr def = NULL;

-        if (!(def = virDomainDefParseString(caps, driver->xmlopt, xmlin,
+        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
                                             QEMU_EXPECTED_VIRT_TYPES,
                                             VIR_DOMAIN_XML_INACTIVE))) {
             goto endjob;
@@ -4767,14 +4765,14 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
         header.was_running = state;

     /* Create a domain from this XML */
-    if (!(def = virDomainDefParseString(caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto error;
     if (xmlin) {
         virDomainDefPtr def2 = NULL;

-        if (!(def2 = virDomainDefParseString(caps, driver->xmlopt, xmlin,
+        if (!(def2 = virDomainDefParseString(xmlin, caps, driver->xmlopt,
                                              QEMU_EXPECTED_VIRT_TYPES,
                                              VIR_DOMAIN_XML_INACTIVE)))
             goto error;
@@ -4947,9 +4945,8 @@ qemuDomainRestoreFlags(virConnectPtr conn,
     if (fd < 0)
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
@@ -5277,7 +5274,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;

-    def = virDomainDefParseString(caps, driver->xmlopt, xmlData,
+    def = virDomainDefParseString(xmlData, caps, driver->xmlopt,
                                   QEMU_EXPECTED_VIRT_TYPES, 0);
     if (!def)
         goto cleanup;
@@ -5548,7 +5545,7 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) {
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;

-    if (!(def = virDomainDefParseString(caps, driver->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
@@ -5565,11 +5562,9 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) {
     if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
-                                   0,
-                                   &oldDef)))
+                                   0, &oldDef)))
         goto cleanup;

     def = NULL;
@@ -5786,8 +5781,8 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
         tmp = dev->data.disk;
         dev->data.disk = orig_disk;

-        if (!(dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt,
-                                                vm->def, dev))) {
+        if (!(dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                                caps, driver->xmlopt))) {
             dev->data.disk = tmp;
             goto end;
         }
@@ -6063,8 +6058,8 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm,
         tmp = dev->data.disk;
         dev->data.disk = orig_disk;

-        if (!(dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt,
-                                                vm->def, dev))) {
+        if (!(dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                                caps, driver->xmlopt))) {
             dev->data.disk = tmp;
             goto end;
         }
@@ -6470,8 +6465,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          goto endjob;
     }

-    dev = dev_copy = virDomainDeviceDefParse(caps, driver->xmlopt,
-                                             vm->def, xml,
+    dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
+                                             caps, driver->xmlopt,
                                              VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto endjob;
@@ -6482,7 +6477,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          * create a deep copy of device as adding
          * to CONFIG takes one instance.
          */
-        dev_copy = virDomainDeviceDefCopy(caps, driver->xmlopt, vm->def, dev);
+        dev_copy = virDomainDeviceDefCopy(dev, vm->def, caps, driver->xmlopt);
         if (!dev_copy)
             goto endjob;
     }
@@ -6497,7 +6492,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             goto endjob;

         /* Make a copy for updated domain. */
-        vmdef = virDomainObjCopyPersistentDef(caps, driver->xmlopt, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
         if (!vmdef)
             goto endjob;
         switch (action) {
@@ -7944,7 +7939,7 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom,

     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         /* Make a copy for updated domain. */
-        vmdef = virDomainObjCopyPersistentDef(caps, driver->xmlopt, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt);
         if (!vmdef)
             goto cleanup;
     }
@@ -11763,7 +11758,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
         /* Easiest way to clone inactive portion of vm->def is via
          * conversion in and back out of xml.  */
         if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)) ||
-            !(def->dom = virDomainDefParseString(caps, driver->xmlopt, xml,
+            !(def->dom = virDomainDefParseString(xml, caps, driver->xmlopt,
                                                  QEMU_EXPECTED_VIRT_TYPES,
                                                  VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;
@@ -12334,7 +12329,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
      * than inactive xml?  */
     snap->def->current = true;
     if (snap->def->dom) {
-        config = virDomainDefCopy(caps, driver->xmlopt, snap->def->dom, true);
+        config = virDomainDefCopy(snap->def->dom, caps, driver->xmlopt, true);
         if (!config)
             goto cleanup;
     }
@@ -12827,9 +12822,8 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
     if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2033318..41ad768 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -921,8 +921,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
                            n);
             goto error;
         }
-        mig->persistent = virDomainDefParseNode(caps, driver->xmlopt,
-                                                doc, nodes[0],
+        mig->persistent = virDomainDefParseNode(doc, nodes[0],
+                                                caps, driver->xmlopt,
                                                 -1, VIR_DOMAIN_XML_INACTIVE);
         if (!mig->persistent) {
             /* virDomainDefParseNode already reported
@@ -1926,7 +1926,7 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver,
     }

     if (xmlin) {
-        if (!(def = virDomainDefParseString(caps, driver->xmlopt, xmlin,
+        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlopt,
                                             QEMU_EXPECTED_VIRT_TYPES,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;
@@ -2030,7 +2030,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;

-    if (!(def = virDomainDefParseString(caps, driver->xmlopt, dom_xml,
+    if (!(def = virDomainDefParseString(dom_xml, caps, driver->xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;
@@ -2071,7 +2071,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                 virDomainDefPtr newdef;

                 VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
-                newdef = virDomainDefParseString(caps, driver->xmlopt, xmlout,
+                newdef = virDomainDefParseString(xmlout, caps, driver->xmlopt,
                                                  QEMU_EXPECTED_VIRT_TYPES,
                                                  VIR_DOMAIN_XML_INACTIVE);
                 if (!newdef)
@@ -2127,9 +2127,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
         }
     }

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 06c19fa..fee63ec 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -729,9 +729,9 @@ get_definition(vahControl * ctl, const char *xmlStr)
         goto exit;
     }

-    ctl->def = virDomainDefParseString(ctl->caps, ctl->xmlopt,
-                                       xmlStr, -1,
-                                       VIR_DOMAIN_XML_INACTIVE);
+    ctl->def = virDomainDefParseString(xmlStr,
+                                       ctl->caps, ctl->xmlopt,
+                                       -1, VIR_DOMAIN_XML_INACTIVE);
     if (ctl->def == NULL) {
         vah_error(ctl, 0, _("could not parse XML"));
         goto exit;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d35dfc4..ecfbe33 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -590,9 +590,9 @@ static int testOpenDefault(virConnectPtr conn) {

     privconn->nextDomID = 1;

-    if (!(domdef = virDomainDefParseString(privconn->caps,
+    if (!(domdef = virDomainDefParseString(defaultDomainXML,
+                                           privconn->caps,
                                            privconn->xmlopt,
-                                           defaultDomainXML,
                                            1 << VIR_DOMAIN_VIRT_TEST,
                                            VIR_DOMAIN_XML_INACTIVE)))
         goto error;
@@ -600,8 +600,9 @@ static int testOpenDefault(virConnectPtr conn) {
     if (testDomainGenerateIfnames(domdef) < 0)
         goto error;
     if (!(domobj = virDomainObjListAdd(privconn->domains,
+                                       domdef,
                                        privconn->xmlopt,
-                                       domdef, 0, NULL)))
+                                       0, NULL)))
         goto error;
     domdef = NULL;

@@ -933,16 +934,16 @@ static int testOpenFromFile(virConnectPtr conn,
                                _("resolving domain filename"));
                 goto error;
             }
-            def = virDomainDefParseFile(privconn->caps,
-                                        privconn->xmlopt, absFile,
+            def = virDomainDefParseFile(absFile, privconn->caps,
+                                        privconn->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_TEST,
                                         VIR_DOMAIN_XML_INACTIVE);
             VIR_FREE(absFile);
             if (!def)
                 goto error;
         } else {
-            if ((def = virDomainDefParseNode(privconn->caps, privconn->xmlopt,
-                                             xml, domains[i],
+            if ((def = virDomainDefParseNode(xml, domains[i],
+                                             privconn->caps, privconn->xmlopt,
                                              1 << VIR_DOMAIN_VIRT_TEST,
                                              VIR_DOMAIN_XML_INACTIVE)) == NULL)
                 goto error;
@@ -950,8 +951,9 @@ static int testOpenFromFile(virConnectPtr conn,

         if (testDomainGenerateIfnames(def) < 0 ||
             !(dom = virDomainObjListAdd(privconn->domains,
+                                        def,
                                         privconn->xmlopt,
-                                        def, 0, NULL))) {
+                                        0, NULL))) {
             virDomainDefFree(def);
             goto error;
         }
@@ -1344,16 +1346,16 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
     virCheckFlags(0, NULL);

     testDriverLock(privconn);
-    if ((def = virDomainDefParseString(privconn->caps, privconn->xmlopt,
-                                       xml, 1 << VIR_DOMAIN_VIRT_TEST,
+    if ((def = virDomainDefParseString(xml,privconn->caps, privconn->xmlopt,
+                                       1 << VIR_DOMAIN_VIRT_TEST,
                                        VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

     if (testDomainGenerateIfnames(def) < 0)
         goto cleanup;
     if (!(dom = virDomainObjListAdd(privconn->domains,
-                                    privconn->xmlopt,
                                     def,
+                                    privconn->xmlopt,
                                     VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                     NULL)))
         goto cleanup;
@@ -1959,8 +1961,8 @@ testDomainRestoreFlags(virConnectPtr conn,
     }
     xml[len] = '\0';

-    def = virDomainDefParseString(privconn->caps, privconn->xmlopt,
-                                  xml, 1 << VIR_DOMAIN_VIRT_TEST,
+    def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
+                                  1 << VIR_DOMAIN_VIRT_TEST,
                                   VIR_DOMAIN_XML_INACTIVE);
     if (!def)
         goto cleanup;
@@ -1968,8 +1970,8 @@ testDomainRestoreFlags(virConnectPtr conn,
     if (testDomainGenerateIfnames(def) < 0)
         goto cleanup;
     if (!(dom = virDomainObjListAdd(privconn->domains,
-                                    privconn->xmlopt,
                                     def,
+                                    privconn->xmlopt,
                                     VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                     VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                     NULL)))
@@ -2510,16 +2512,16 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
     virDomainDefPtr oldDef = NULL;

     testDriverLock(privconn);
-    if ((def = virDomainDefParseString(privconn->caps, privconn->xmlopt,
-                                       xml, 1 << VIR_DOMAIN_VIRT_TEST,
+    if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt,
+                                       1 << VIR_DOMAIN_VIRT_TEST,
                                        VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

     if (testDomainGenerateIfnames(def) < 0)
         goto cleanup;
     if (!(dom = virDomainObjListAdd(privconn->domains,
-                                    privconn->xmlopt,
                                     def,
+                                    privconn->xmlopt,
                                     0,
                                     &oldDef)))
         goto cleanup;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index f9a7920..2476d1c 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -541,11 +541,11 @@ umlStartup(bool privileged,
         goto error;

     if (virDomainObjListLoadAllConfigs(uml_driver->domains,
+                                       uml_driver->configDir,
+                                       uml_driver->autostartDir, 0,
                                        uml_driver->caps,
                                        uml_driver->xmlopt,
-                                       uml_driver->configDir,
-                                       uml_driver->autostartDir,
-                                       0, 1 << VIR_DOMAIN_VIRT_UML,
+                                       1 << VIR_DOMAIN_VIRT_UML,
                                        NULL, NULL) < 0)
         goto error;

@@ -597,11 +597,11 @@ umlReload(void) {

     umlDriverLock(uml_driver);
     virDomainObjListLoadAllConfigs(uml_driver->domains,
+                                   uml_driver->configDir,
+                                   uml_driver->autostartDir, 0,
                                    uml_driver->caps,
                                    uml_driver->xmlopt,
-                                   uml_driver->configDir,
-                                   uml_driver->autostartDir,
-                                   0, 1 << VIR_DOMAIN_VIRT_UML,
+                                   1 << VIR_DOMAIN_VIRT_UML,
                                    umlNotifyLoadDomain, uml_driver);
     umlDriverUnlock(uml_driver);

@@ -1504,14 +1504,13 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
     virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, NULL);

     umlDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_UML,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -1925,14 +1924,13 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) {
     virDomainPtr dom = NULL;

     umlDriverLock(driver);
-    if (!(def = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_UML,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlopt,
-                                   def,
                                    0, NULL)))
         goto cleanup;
     def = NULL;
@@ -2080,7 +2078,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
         goto cleanup;
     }

-    dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt, vm->def, xml,
+    dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
                                   VIR_DOMAIN_XML_INACTIVE);

     if (dev == NULL)
@@ -2198,7 +2196,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) {
         goto cleanup;
     }

-    dev = virDomainDeviceDefParse(driver->caps, driver->xmlopt, vm->def, xml,
+    dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
                                   VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index eb6460c..d021105 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -5052,8 +5052,8 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
 #endif
     nsresult rc;

-    if (!(def = virDomainDefParseString(data->caps, data->xmlopt,
-                                        xml, 1 << VIR_DOMAIN_VIRT_VBOX,
+    if (!(def = virDomainDefParseString(xml, data->caps, data->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_VBOX,
                                         VIR_DOMAIN_XML_INACTIVE))) {
         goto cleanup;
     }
@@ -5396,8 +5396,8 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
         goto cleanup;
     }

-    dev = virDomainDeviceDefParse(data->caps, data->xmlopt,
-                                  def, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;

@@ -5631,8 +5631,8 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) {
         goto cleanup;
     }

-    dev = virDomainDeviceDefParse(data->caps, data->xmlopt,
-                                  def, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlopt,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;

diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 00a5590..3528f07 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -178,9 +178,9 @@ vmwareLoadDomains(struct vmware_driver *driver)
             goto cleanup;
         }

-        if (!(vm = virDomainObjListAdd(driver->domains,
+        if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
                                        driver->xmlopt,
-                                       vmdef, 0, NULL)))
+                                       0, NULL)))
             goto cleanup;

         pDomain = vm->privateData;
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 2dd6f81..0e0f59d 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -324,8 +324,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
     ctx.formatFileName = vmwareCopyVMXFileName;

     vmwareDriverLock(driver);
-    if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                         xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                         1 << VIR_DOMAIN_VIRT_VMWARE,
                                          VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

@@ -346,8 +346,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)

     /* assign def */
     if (!(vm = virDomainObjListAdd(driver->domains,
-                                   driver->xmlopt,
                                    vmdef,
+                                   driver->xmlopt,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
@@ -595,8 +595,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,

     vmwareDriverLock(driver);

-    if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlopt,
-                                         xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
+                                         1 << VIR_DOMAIN_VIRT_VMWARE,
                                          VIR_DOMAIN_XML_INACTIVE)) == NULL)
         goto cleanup;

@@ -617,8 +617,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,

     /* assign def */
     if (!(vm = virDomainObjListAdd(driver->domains,
-                                   driver->xmlopt,
                                    vmdef,
+                                   driver->xmlopt,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 38dce0a..fe6252c 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1434,8 +1434,8 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn,
         goto cleanup;
     }

-    if (!(def = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                        xmlData, 1 << VIR_DOMAIN_VIRT_XEN, 0)))
+    if (!(def = virDomainDefParseString(xmlData, priv->caps, priv->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN, 0)))
         goto cleanup;

     if (STREQ(format, XEN_CONFIG_FORMAT_XM)) {
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index f6ce8eb..83d6d39 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -2409,8 +2409,8 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc, unsigned int flags)

     virCheckFlags(0, NULL);

-    if (!(def = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                        xmlDesc, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xmlDesc, priv->caps, priv->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         return NULL;

@@ -2519,8 +2519,8 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain,
                                      NULL)))
         goto cleanup;

-    if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
-                                        def, xml, VIR_DOMAIN_XML_INACTIVE)))
+    if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;


@@ -2679,8 +2679,8 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain,
                                      NULL)))
         goto cleanup;

-    if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
-                                        def, xml, VIR_DOMAIN_XML_INACTIVE)))
+    if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;


@@ -2786,8 +2786,8 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain,
                                      NULL)))
         goto cleanup;

-    if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlopt,
-                                        def, xml, VIR_DOMAIN_XML_INACTIVE)))
+    if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlopt,
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

     if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref)))
@@ -3127,8 +3127,8 @@ xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc)
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
         return NULL;

-    if (!(def = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                        xmlDesc, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xmlDesc, priv->caps, priv->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE))) {
         virReportError(VIR_ERR_XML_ERROR,
                        "%s", _("failed to parse domain description"));
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 69c8f4a..b3a537a 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1013,7 +1013,7 @@ xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
         return NULL;
     }

-    if (!(def = virDomainDefParseString(priv->caps, priv->xmlopt, xml,
+    if (!(def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE))) {
         xenUnifiedUnlock(priv);
@@ -1310,10 +1310,10 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain,
         goto cleanup;
     def = entry->def;

-    if (!(dev = virDomainDeviceDefParse(priv->caps,
+    if (!(dev = virDomainDeviceDefParse(xml, entry->def,
+                                        priv->caps,
                                         priv->xmlopt,
-                                        entry->def,
-                                        xml, VIR_DOMAIN_XML_INACTIVE)))
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

     switch (dev->type) {
@@ -1404,10 +1404,10 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain,
         goto cleanup;
     def = entry->def;

-    if (!(dev = virDomainDeviceDefParse(priv->caps,
+    if (!(dev = virDomainDeviceDefParse(xml, entry->def,
+                                        priv->caps,
                                         priv->xmlopt,
-                                        entry->def,
-                                        xml, VIR_DOMAIN_XML_INACTIVE)))
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

     switch (dev->type) {
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 712c20b..d619609 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -533,8 +533,8 @@ xenapiDomainCreateXML(virConnectPtr conn,

     virCheckFlags(0, NULL);

-    virDomainDefPtr defPtr = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                                     xmlDesc,
+    virDomainDefPtr defPtr = virDomainDefParseString(xmlDesc,
+                                                     priv->caps, priv->xmlopt,
                                                      1 << VIR_DOMAIN_VIRT_XEN,
                                                      flags);
     createVMRecordFromXml(conn, defPtr, &record, &vm);
@@ -1687,8 +1687,8 @@ xenapiDomainDefineXML(virConnectPtr conn, const char *xml)
     virDomainPtr domP=NULL;
     if (!priv->caps)
         return NULL;
-    virDomainDefPtr defPtr = virDomainDefParseString(priv->caps, priv->xmlopt,
-                                                     xml,
+    virDomainDefPtr defPtr = virDomainDefParseString(xml,
+                                                     priv->caps, priv->xmlopt,
                                                      1 << VIR_DOMAIN_VIRT_XEN,
                                                      0);
     if (!defPtr)
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 16118bb..e0f99f4 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -32,7 +32,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;

-    if (!(def = virDomainDefParseString(caps, xmlopt, inXmlData,
+    if (!(def = virDomainDefParseString(inXmlData, caps, xmlopt,
                                         1 << VIR_DOMAIN_VIRT_LXC,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 71921e7..7a63e90 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -100,7 +100,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
         goto out;
     conn->secretDriver = &fakeSecretDriver;

-    if (!(vmdef = virDomainDefParseFile(driver.caps, driver.xmlopt, xml,
+    if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE))) {
         if (flags & FLAG_EXPECT_PARSE_ERROR)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7305e2d..8f892d1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -32,7 +32,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
     if (virtTestLoadFile(outxml, &outXmlData) < 0)
         goto fail;

-    if (!(def = virDomainDefParseString(driver.caps, driver.xmlopt, inXmlData,
+    if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 6492bac..dadf40c 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -51,7 +51,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (len && expectargv[len - 1] == '\n')
         expectargv[len - 1] = '\0';

-    if (!(vmdef = virDomainDefParseFile(driver.caps, driver.xmlopt, xml,
+    if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index ac229de..c595f9b 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -166,7 +166,7 @@ testSELinuxLoadDef(const char *testname)
         goto cleanup;
     }

-    if (!(def = virDomainDefParseString(caps, xmlopt, xmlstr,
+    if (!(def = virDomainDefParseString(xmlstr, caps, xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         0)))
         goto cleanup;
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 80833eb..af80061 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -69,7 +69,7 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
     priv.caps = caps;
     conn->privateData = &priv;

-    if (!(def = virDomainDefParseString(caps, xmlopt, xmlData,
+    if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index daf4ac6..a091d45 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -32,7 +32,7 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
   if (virtTestLoadFile(sexpr, &sexprData) < 0)
       goto fail;

-  if (!(def = virDomainDefParseString(caps, xmlopt, xmlData,
+  if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
                                       1 << VIR_DOMAIN_VIRT_XEN,
                                       VIR_DOMAIN_XML_INACTIVE)))
       goto fail;
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 5195ffa..cee7f9e 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -94,7 +94,7 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
         goto failure;
     }

-    def = virDomainDefParseString(caps, xmlopt, xmlData,
+    def = virDomainDefParseString(xmlData, caps, xmlopt,
                                   1 << VIR_DOMAIN_VIRT_VMWARE,
                                   VIR_DOMAIN_XML_INACTIVE);

-- 
1.8.1.5


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