---
src/vmware/vmware_conf.c | 3 ++-
src/vmware/vmware_conf.h | 1 +
src/vmware/vmware_driver.c | 25 +++++++++++++++++--------
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index a17b2e1..19be62a 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -45,6 +45,7 @@ vmwareFreeDriver(struct vmware_driver *driver)
virMutexDestroy(&driver->lock);
virObjectUnref(driver->domains);
virObjectUnref(driver->caps);
+ virObjectUnref(driver->xmlconf);
VIR_FREE(driver);
}
@@ -178,7 +179,7 @@ vmwareLoadDomains(struct vmware_driver *driver)
}
if (!(vm = virDomainObjListAdd(driver->domains,
- driver->caps,
+ driver->xmlconf,
vmdef, 0, NULL)))
goto cleanup;
diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
index 6ab985e..b3ec966 100644
--- a/src/vmware/vmware_conf.h
+++ b/src/vmware/vmware_conf.h
@@ -36,6 +36,7 @@
struct vmware_driver {
virMutex lock;
virCapsPtr caps;
+ virDomainXMLConfPtr xmlconf;
virDomainObjListPtr domains;
int version;
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index b7905fa..6d82532 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -72,6 +72,15 @@ vmwareDataFreeFunc(void *data)
VIR_FREE(dom);
}
+static virDomainXMLConfPtr
+vmwareDomainXMLConfigInit(void)
+{
+ virDomainXMLPrivateDataCallbacks priv = { .alloc = vmwareDataAllocFunc,
+ .free = vmwareDataFreeFunc };
+
+ return virDomainXMLConfNew(&priv, NULL);
+}
+
static virDrvOpenStatus
vmwareOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
@@ -134,8 +143,8 @@ vmwareOpen(virConnectPtr conn,
if (!(driver->caps = vmwareCapsInit()))
goto cleanup;
- driver->caps->privateDataAllocFunc = vmwareDataAllocFunc;
- driver->caps->privateDataFreeFunc = vmwareDataFreeFunc;
+ if (!(driver->xmlconf = vmwareDomainXMLConfigInit()))
+ goto cleanup;
if (vmwareLoadDomains(driver) < 0)
goto cleanup;
@@ -315,8 +324,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
ctx.formatFileName = vmwareCopyVMXFileName;
vmwareDriverLock(driver);
- if ((vmdef = virDomainDefParseString(driver->caps, xml,
- 1 << VIR_DOMAIN_VIRT_VMWARE,
+ if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlconf,
+ xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
@@ -337,7 +346,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
/* assign def */
if (!(vm = virDomainObjListAdd(driver->domains,
- driver->caps,
+ driver->xmlconf,
vmdef,
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
@@ -586,8 +595,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
vmwareDriverLock(driver);
- if ((vmdef = virDomainDefParseString(driver->caps, xml,
- 1 << VIR_DOMAIN_VIRT_VMWARE,
+ if ((vmdef = virDomainDefParseString(driver->caps, driver->xmlconf,
+ xml, 1 << VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
@@ -608,7 +617,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
/* assign def */
if (!(vm = virDomainObjListAdd(driver->domains,
- driver->caps,
+ driver->xmlconf,
vmdef,
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
--
1.8.1.5