[PATCHv5 02/11] conf callback: Rearrange function parameters

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

 



Move the xmlconf and caps arguments to the end of the argument list.
---

Notes:
    Version 5:
    - new in series, renaming suggested by Laine
    
    Version 4:
    - added support for opaque data for the callback
    - removed post-devices domain config callback until it's needed
    - renamed the structure holding the data as it will also contain some defaults as values
    - squashed patch adding the new argument to the contstructor

 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 7ebac12..c34093b 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,
-                          virDomainXMLConfPtr xmlconf,
                           const virDomainDefPtr def,
+                          virDomainXMLConfPtr xmlconf,
                           unsigned int flags,
                           virDomainDefPtr *oldDef)
 {
@@ -2071,15 +2071,15 @@ error:


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

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

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

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

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


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


 static virDomainObjPtr
-virDomainObjParseXML(virCapsPtr caps,
-                     virDomainXMLConfPtr xmlconf,
-                     xmlDocPtr xml,
+virDomainObjParseXML(xmlDocPtr xml,
                      xmlXPathContextPtr ctxt,
+                     virCapsPtr caps,
+                     virDomainXMLConfPtr xmlconf,
                      unsigned int expectedVirtTypes,
                      unsigned int flags)
 {
@@ -11132,8 +11132,8 @@ virDomainObjParseXML(virCapsPtr caps,

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

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

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

 virDomainDefPtr
-virDomainDefParseString(virCapsPtr caps,
+virDomainDefParseString(const char *xmlStr,
+                        virCapsPtr caps,
                         virDomainXMLConfPtr xmlconf,
-                        const char *xmlStr,
                         unsigned int expectedVirtTypes,
                         unsigned int flags)
 {
@@ -11236,9 +11236,9 @@ virDomainDefParseString(virCapsPtr caps,
 }

 virDomainDefPtr
-virDomainDefParseFile(virCapsPtr caps,
+virDomainDefParseFile(const char *filename,
+                      virCapsPtr caps,
                       virDomainXMLConfPtr xmlconf,
-                      const char *filename,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11248,10 +11248,10 @@ virDomainDefParseFile(virCapsPtr caps,


 virDomainDefPtr
-virDomainDefParseNode(virCapsPtr caps,
-                      virDomainXMLConfPtr xmlconf,
-                      xmlDocPtr xml,
+virDomainDefParseNode(xmlDocPtr xml,
                       xmlNodePtr root,
+                      virCapsPtr caps,
+                      virDomainXMLConfPtr xmlconf,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11273,7 +11273,7 @@ virDomainDefParseNode(virCapsPtr caps,
     }

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

 cleanup:
@@ -11283,10 +11283,10 @@ cleanup:


 static virDomainObjPtr
-virDomainObjParseNode(virCapsPtr caps,
-                      virDomainXMLConfPtr xmlconf,
-                      xmlDocPtr xml,
+virDomainObjParseNode(xmlDocPtr xml,
                       xmlNodePtr root,
+                      virCapsPtr caps,
+                      virDomainXMLConfPtr xmlconf,
                       unsigned int expectedVirtTypes,
                       unsigned int flags)
 {
@@ -11307,7 +11307,7 @@ virDomainObjParseNode(virCapsPtr caps,
     }

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

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


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

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

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

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

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

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

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

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

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

     VIR_FREE(xml);
     return ret;
 }

 virDomainDefPtr
-virDomainObjCopyPersistentDef(virCapsPtr caps,
-                              virDomainXMLConfPtr xmlconf,
-                              virDomainObjPtr dom)
+virDomainObjCopyPersistentDef(virDomainObjPtr dom,
+                              virCapsPtr caps,
+                              virDomainXMLConfPtr xmlconf)
 {
     virDomainDefPtr cur;

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


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

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

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

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

 void virDomainObjListRemove(virDomainObjListPtr doms,
                             virDomainObjPtr dom);

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

@@ -2233,11 +2235,11 @@ typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                           void *opaque);

 int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
-                                   virCapsPtr caps,
-                                   virDomainXMLConfPtr xmlconf,
                                    const char *configDir,
                                    const char *autostartDir,
                                    int liveStatus,
+                                   virCapsPtr caps,
+                                   virDomainXMLConfPtr xmlconf,
                                    unsigned int expectedVirtTypes,
                                    virDomainLoadConfigNotify notify,
                                    void *opaque);
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 1154202..d8d8ae7 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, xmlconf, xml, domainNode,
+            def->dom = virDomainDefParseNode(xml, domainNode, caps, xmlconf,
                                              expectedVirtTypes,
                                              (VIR_DOMAIN_XML_INACTIVE |
                                               VIR_DOMAIN_XML_SECURE));
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 2bff60e..7a12ae3 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->xmlconf,
-                                  domainXml, 1 << VIR_DOMAIN_VIRT_VMWARE, 0);
+    def = virDomainDefParseString(domainXml, priv->caps, priv->xmlconf,
+                                  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->xmlconf,
-                                  xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    def = virDomainDefParseString(xml, priv->caps, priv->xmlconf,
+                                  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 fd69637..90e48dc 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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                        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->xmlconf,
                                        libxl_driver->stateDir,
                                        libxl_driver->autostartDir,
-                                       1, 1 << VIR_DOMAIN_VIRT_XEN,
+                                       1,
+                                       libxl_driver->caps,
+                                       libxl_driver->xmlconf,
+                                       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->xmlconf,
                                        libxl_driver->configDir,
                                        libxl_driver->autostartDir,
-                                       0, 1 << VIR_DOMAIN_VIRT_XEN,
+                                       0,
+                                       libxl_driver->caps,
+                                       libxl_driver->xmlconf,
+                                       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->xmlconf,
                                    libxl_driver->configDir,
                                    libxl_driver->autostartDir,
-                                   1, 1 << VIR_DOMAIN_VIRT_XEN,
+                                   1,
+                                   libxl_driver->caps,
+                                   libxl_driver->xmlconf,
+                                   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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlconf,
-                                   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->xmlconf,
-                                   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->xmlconf, domainXml,
+    if (!(def = virDomainDefParseString(domainXml,
+                                        driver->caps, driver->xmlconf,
                                         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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlconf,
-                                   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->xmlconf,
-                                            vm->def, xml,
+        if (!(dev = virDomainDeviceDefParse(xml, vm->def,
+                                            driver->caps, driver->xmlconf,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;

         /* Make a copy for updated domain. */
-        if (!(vmdef = virDomainObjCopyPersistentDef(driver->caps,
-                                                    driver->xmlconf, vm)))
+        if (!(vmdef = virDomainObjCopyPersistentDef(vm, driver->caps,
+                                                    driver->xmlconf)))
             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->xmlconf,
-                                            vm->def, xml,
+        if (!(dev = virDomainDeviceDefParse(xml, vm->def,
+                                            driver->caps, driver->xmlconf,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 1d1443c..cde85b4 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, xmlconf,
-                                           configFile,
+    if ((ctrl->def = virDomainDefParseFile(configFile,
+                                           caps, xmlconf,
                                            1 << VIR_DOMAIN_VIRT_LXC,
                                            0)) == NULL)
         goto error;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index dc71c16..9f17baa 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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
                                         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->xmlconf,
-                                   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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
                                         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->xmlconf,
-                                   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->xmlconf,
-                                       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->xmlconf,
-                                       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->xmlconf,
-                                   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->xmlconf, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, driver->caps, driver->xmlconf);
         if (!vmdef)
             goto cleanup;
     }
@@ -4360,8 +4357,8 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          goto cleanup;
     }

-    dev = dev_copy = virDomainDeviceDefParse(driver->caps, driver->xmlconf,
-                                             vm->def, xml,
+    dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
+                                             driver->caps, driver->xmlconf,
                                              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->xmlconf,
-                                          vm->def, dev);
+        dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                          driver->caps, driver->xmlconf);
         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->xmlconf, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, driver->caps, driver->xmlconf);
         if (!vmdef)
             goto cleanup;
         switch (action) {
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index e3e64e5..9ec1d24 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->xmlconf,
                                         def,
+                                        driver->xmlconf,
                                         flags,
                                         NULL)))
             goto cleanup;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index a6f4c66..0cf9156 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->xmlconf,
-                                         xml, 1 << VIR_DOMAIN_VIRT_OPENVZ,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                         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->xmlconf,
-                                   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->xmlconf,
-                                         xml, 1 << VIR_DOMAIN_VIRT_OPENVZ,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                         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->xmlconf,
                                    vmdef,
+                                   driver->xmlconf,
                                    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->xmlconf,
-                                  vmdef, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, vmdef, driver->caps, driver->xmlconf,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (!dev)
         goto cleanup;

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index ffb86dc..d8c1def 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->xmlconf,
-                                    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->xmlconf,
-                                       xml, 1 << VIR_DOMAIN_VIRT_PARALLELS,
+    if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlconf,
+                                       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->xmlconf,
-                                    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 6063256..59c3bc2 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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_PHYP,
+    if (!(def = virDomainDefParseString(xml, phyp_driver->caps,
+                                        phyp_driver->xmlconf,
+                                        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 f99b3c6..c1275b3 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->xmlconf,
-                                       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->xmlconf,
-                                       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->xmlconf,
                                    cfg->configDir,
-                                   cfg->autostartDir,
-                                   0, QEMU_EXPECTED_VIRT_TYPES,
+                                   cfg->autostartDir, 0,
+                                   caps, qemu_driver->xmlconf,
+                                   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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlconf,
                                         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->xmlconf,
-                                   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->xmlconf, xmlin,
+        if (!(def = virDomainDefParseString(xmlin, caps, driver->xmlconf,
                                             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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlconf,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto error;
     if (xmlin) {
         virDomainDefPtr def2 = NULL;

-        if (!(def2 = virDomainDefParseString(caps, driver->xmlconf, xmlin,
+        if (!(def2 = virDomainDefParseString(xmlin, caps, driver->xmlconf,
                                              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->xmlconf,
-                                   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->xmlconf, xmlData,
+    def = virDomainDefParseString(xmlData, caps, driver->xmlconf,
                                   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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, caps, driver->xmlconf,
                                         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->xmlconf,
-                                   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->xmlconf,
-                                                vm->def, dev))) {
+        if (!(dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                                caps, driver->xmlconf))) {
             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->xmlconf,
-                                                vm->def, dev))) {
+        if (!(dev_copy = virDomainDeviceDefCopy(dev, vm->def,
+                                                caps, driver->xmlconf))) {
             dev->data.disk = tmp;
             goto end;
         }
@@ -6467,8 +6462,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
          goto endjob;
     }

-    dev = dev_copy = virDomainDeviceDefParse(caps, driver->xmlconf,
-                                             vm->def, xml,
+    dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
+                                             caps, driver->xmlconf,
                                              VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto endjob;
@@ -6479,7 +6474,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->xmlconf, vm->def, dev);
+        dev_copy = virDomainDeviceDefCopy(dev, vm->def, caps, driver->xmlconf);
         if (!dev_copy)
             goto endjob;
     }
@@ -6494,7 +6489,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             goto endjob;

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

     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
         /* Make a copy for updated domain. */
-        vmdef = virDomainObjCopyPersistentDef(caps, driver->xmlconf, vm);
+        vmdef = virDomainObjCopyPersistentDef(vm, caps, driver->xmlconf);
         if (!vmdef)
             goto cleanup;
     }
@@ -11760,7 +11755,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->xmlconf, xml,
+            !(def->dom = virDomainDefParseString(xml, caps, driver->xmlconf,
                                                  QEMU_EXPECTED_VIRT_TYPES,
                                                  VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;
@@ -12331,7 +12326,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
      * than inactive xml?  */
     snap->def->current = true;
     if (snap->def->dom) {
-        config = virDomainDefCopy(caps, driver->xmlconf, snap->def->dom, true);
+        config = virDomainDefCopy(snap->def->dom, caps, driver->xmlconf, true);
         if (!config)
             goto cleanup;
     }
@@ -12824,9 +12819,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->xmlconf,
-                                   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 15f3cef..b0df4f4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -919,8 +919,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
                            n);
             goto error;
         }
-        mig->persistent = virDomainDefParseNode(caps, driver->xmlconf,
-                                                doc, nodes[0],
+        mig->persistent = virDomainDefParseNode(doc, nodes[0],
+                                                caps, driver->xmlconf,
                                                 -1, VIR_DOMAIN_XML_INACTIVE);
         if (!mig->persistent) {
             /* virDomainDefParseNode already reported
@@ -1924,7 +1924,7 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver,
     }

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

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

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

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlconf,
-                                   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 2f2bc71..bdae3cc 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->xmlconf,
-                                       xmlStr, -1,
-                                       VIR_DOMAIN_XML_INACTIVE);
+    ctl->def = virDomainDefParseString(xmlStr,
+                                       ctl->caps, ctl->xmlconf,
+                                       -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 76e04c3..47973e5 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -588,9 +588,9 @@ static int testOpenDefault(virConnectPtr conn) {

     privconn->nextDomID = 1;

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

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

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

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

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

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

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

     if (testDomainGenerateIfnames(def) < 0)
         goto cleanup;
     if (!(dom = virDomainObjListAdd(privconn->domains,
-                                    privconn->xmlconf,
                                     def,
+                                    privconn->xmlconf,
                                     0,
                                     &oldDef)))
         goto cleanup;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index ba88b2d..6790bd7 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->xmlconf,
-                                       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->xmlconf,
-                                   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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                        1 << VIR_DOMAIN_VIRT_UML,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlconf,
-                                   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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
+    if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                        1 << VIR_DOMAIN_VIRT_UML,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;

-    if (!(vm = virDomainObjListAdd(driver->domains,
+    if (!(vm = virDomainObjListAdd(driver->domains, def,
                                    driver->xmlconf,
-                                   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->xmlconf, vm->def, xml,
+    dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlconf,
                                   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->xmlconf, vm->def, xml,
+    dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlconf,
                                   VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index dd96e7b..e2dd81c 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->xmlconf,
-                                        xml, 1 << VIR_DOMAIN_VIRT_VBOX,
+    if (!(def = virDomainDefParseString(xml, data->caps, data->xmlconf,
+                                        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->xmlconf,
-                                  def, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlconf,
+                                  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->xmlconf,
-                                  def, xml, VIR_DOMAIN_XML_INACTIVE);
+    dev = virDomainDeviceDefParse(xml, def, data->caps, data->xmlconf,
+                                  VIR_DOMAIN_XML_INACTIVE);
     if (dev == NULL)
         goto cleanup;

diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 19be62a..fe28034 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->xmlconf,
-                                       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 bf4c1ff..9512275 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->xmlconf,
-                                         xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                         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->xmlconf,
                                    vmdef,
+                                   driver->xmlconf,
                                    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->xmlconf,
-                                         xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
+    if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlconf,
+                                         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->xmlconf,
                                    vmdef,
+                                   driver->xmlconf,
                                    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 2ef3609..cc053dc 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->xmlconf,
-                                        xmlData, 1 << VIR_DOMAIN_VIRT_XEN, 0)))
+    if (!(def = virDomainDefParseString(xmlData, priv->caps, priv->xmlconf,
+                                        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 93ba456..03d08fc 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->xmlconf,
-                                        xmlDesc, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xmlDesc, priv->caps, priv->xmlconf,
+                                        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->xmlconf,
-                                        def, xml, VIR_DOMAIN_XML_INACTIVE)))
+    if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlconf,
+                                        VIR_DOMAIN_XML_INACTIVE)))
         goto cleanup;


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

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


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

-    if (!(dev = virDomainDeviceDefParse(priv->caps, priv->xmlconf,
-                                        def, xml, VIR_DOMAIN_XML_INACTIVE)))
+    if (!(dev = virDomainDeviceDefParse(xml, def, priv->caps, priv->xmlconf,
+                                        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->xmlconf,
-                                        xmlDesc, 1 << VIR_DOMAIN_VIRT_XEN,
+    if (!(def = virDomainDefParseString(xmlDesc, priv->caps, priv->xmlconf,
+                                        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 2a42e0a..618d4f1 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->xmlconf, xml,
+    if (!(def = virDomainDefParseString(xml, priv->caps, priv->xmlconf,
                                         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->xmlconf,
-                                        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->xmlconf,
-                                        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 941f3bd..ca8ea41 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->xmlconf,
-                                                     xmlDesc,
+    virDomainDefPtr defPtr = virDomainDefParseString(xmlDesc,
+                                                     priv->caps, priv->xmlconf,
                                                      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->xmlconf,
-                                                     xml,
+    virDomainDefPtr defPtr = virDomainDefParseString(xml,
+                                                     priv->caps, priv->xmlconf,
                                                      1 << VIR_DOMAIN_VIRT_XEN,
                                                      0);
     if (!defPtr)
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 964d433..b7c010f 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, xmlconf, inXmlData,
+    if (!(def = virDomainDefParseString(inXmlData, caps, xmlconf,
                                         1 << VIR_DOMAIN_VIRT_LXC,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 38787ac..db1b794 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.xmlconf, xml,
+    if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlconf,
                                         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 ba9aa96..eb62409 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.xmlconf, inXmlData,
+    if (!(def = virDomainDefParseString(inXmlData, driver.caps, driver.xmlconf,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 76a715d..7a5ac2c 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.xmlconf, xml,
+    if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlconf,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 405bc2b..e296e95 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -166,7 +166,7 @@ testSELinuxLoadDef(const char *testname)
         goto cleanup;
     }

-    if (!(def = virDomainDefParseString(caps, xmlconf, xmlstr,
+    if (!(def = virDomainDefParseString(xmlstr, caps, xmlconf,
                                         QEMU_EXPECTED_VIRT_TYPES,
                                         0)))
         goto cleanup;
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index a32c11a..e8dc22f 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, xmlconf, xmlData,
+    if (!(def = virDomainDefParseString(xmlData, caps, xmlconf,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE)))
         goto fail;
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 364601a..efa149e 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, xmlconf, xmlData,
+  if (!(def = virDomainDefParseString(xmlData, caps, xmlconf,
                                       1 << VIR_DOMAIN_VIRT_XEN,
                                       VIR_DOMAIN_XML_INACTIVE)))
       goto fail;
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index c606036..f592823 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, xmlconf, xmlData,
+    def = virDomainDefParseString(xmlData, caps, xmlconf,
                                   1 << VIR_DOMAIN_VIRT_VMWARE,
                                   VIR_DOMAIN_XML_INACTIVE);

-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]