Use the virDomainXMLConf structure to hold this data.
---
Notes:
Version 4:
- new in series
src/conf/capabilities.h | 1 -
src/conf/domain_conf.c | 13 +++++++------
src/conf/domain_conf.h | 8 +++++++-
src/esx/esx_driver.c | 12 +++++-------
src/libvirt_vmx.syms | 2 ++
src/qemu/qemu_command.c | 9 +++++----
src/vmware/vmware_conf.c | 2 +-
src/vmware/vmware_driver.c | 6 +++---
src/vmx/vmx.c | 38 ++++++++++++++++++++++++++------------
src/vmx/vmx.h | 12 +++++++-----
tests/vmx2xmltest.c | 10 +++++++---
tests/xml2vmxtest.c | 7 +++----
12 files changed, 73 insertions(+), 47 deletions(-)
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index 22a7a3d..f4cf8f3 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -164,7 +164,6 @@ struct _virCaps {
/* Move to virDomainXMLConf later */
unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
int (*defaultConsoleTargetType)(const char *ostype, virArch guestarch);
- bool hasWideScsiBus;
};
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6cebe67..cad5387 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3640,7 +3640,8 @@ virDomainDiskFindByBusAndDst(virDomainDefPtr def,
}
int
-virDomainDiskDefAssignAddress(virCapsPtr caps, virDomainDiskDefPtr def)
+virDomainDiskDefAssignAddress(virDomainXMLConfPtr xmlconf,
+ virDomainDiskDefPtr def)
{
int idx = virDiskNameToIndex(def->dst);
if (idx < 0) {
@@ -3654,7 +3655,7 @@ virDomainDiskDefAssignAddress(virCapsPtr caps, virDomainDiskDefPtr
def)
case VIR_DOMAIN_DISK_BUS_SCSI:
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
- if (caps->hasWideScsiBus) {
+ if (xmlconf->config.hasWideScsiBus) {
/* For a wide SCSI bus we define the default mapping to be
* 16 units per bus, 1 bus per controller, many controllers.
* Unit 7 is the SCSI controller itself. Therefore unit 7
@@ -4093,7 +4094,7 @@ cleanup:
* @param node XML nodeset to parse for disk definition
*/
static virDomainDiskDefPtr
-virDomainDiskDefParseXML(virCapsPtr caps,
+virDomainDiskDefParseXML(virDomainXMLConfPtr xmlconf,
xmlNodePtr node,
xmlXPathContextPtr ctxt,
virBitmapPtr bootMap,
@@ -4875,7 +4876,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
}
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE
- && virDomainDiskDefAssignAddress(caps, def) < 0)
+ && virDomainDiskDefAssignAddress(xmlconf, def) < 0)
goto error;
cleanup:
@@ -8537,7 +8538,7 @@ virDomainDeviceDefParse(virCapsPtr caps,
if (xmlStrEqual(node->name, BAD_CAST "disk")) {
dev->type = VIR_DOMAIN_DEVICE_DISK;
- if (!(dev->data.disk = virDomainDiskDefParseXML(caps, node, ctxt,
+ if (!(dev->data.disk = virDomainDiskDefParseXML(xmlconf, node, ctxt,
NULL, def->seclabels,
def->nseclabels,
flags)))
@@ -10392,7 +10393,7 @@ virDomainDefParseXML(virCapsPtr caps,
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainDiskDefPtr disk = virDomainDiskDefParseXML(caps,
+ virDomainDiskDefPtr disk = virDomainDiskDefParseXML(xmlconf,
nodes[i],
ctxt,
bootMap,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a82a432..a253438 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1965,11 +1965,16 @@ typedef int
(*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
struct _virDomainDefParserConfig {
+ /* driver domain definition callbacks */
virDomainDefPostParseCallback domainConfigCallback;
virDomainDeviceDefPostParseCallback devicesConfigCallback;
+ /* private data for the callbacks */
void *priv;
virFreeCallback privFree;
+
+ /* data */
+ bool hasWideScsiBus;
};
typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
@@ -2166,7 +2171,8 @@ int virDomainDiskInsert(virDomainDefPtr def,
virDomainDiskDefPtr disk);
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
virDomainDiskDefPtr disk);
-int virDomainDiskDefAssignAddress(virCapsPtr caps, virDomainDiskDefPtr def);
+int virDomainDiskDefAssignAddress(virDomainXMLConfPtr xmlconf,
+ virDomainDiskDefPtr def);
virDomainDiskDefPtr
virDomainDiskRemove(virDomainDefPtr def, size_t i);
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 2bff60e..ff2a9b8 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -601,7 +601,6 @@ esxCapsInit(esxPrivate *priv)
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr");
- caps->hasWideScsiBus = true;
caps->defaultConsoleTargetType = esxDefaultConsoleType;
if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) {
@@ -888,7 +887,6 @@ esxConnectToVCenter(esxPrivate *priv,
}
-
/*
* URI format:
{vpx|esx|gsx}://[<username>@]<hostname>[:<port>]/[<path>][?<query
parameter>...]
* <path> =
[<folder>/...]<datacenter>/[<folder>/...]<computeresource>[/<hostsystem>]
@@ -1100,7 +1098,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
goto cleanup;
}
- if (!(priv->xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
+ if (!(priv->xmlconf = virVMXDomainXMLConfInit()))
goto cleanup;
conn->privateData = priv;
@@ -2786,7 +2784,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
ctx.formatFileName = NULL;
ctx.autodetectSCSIControllerModel = NULL;
- def = virVMXParseConfig(&ctx, priv->caps, vmx);
+ def = virVMXParseConfig(&ctx, priv->xmlconf, vmx);
if (def != NULL) {
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
@@ -2845,7 +2843,7 @@ esxDomainXMLFromNative(virConnectPtr conn, const char
*nativeFormat,
ctx.formatFileName = NULL;
ctx.autodetectSCSIControllerModel = NULL;
- def = virVMXParseConfig(&ctx, priv->caps, nativeConfig);
+ def = virVMXParseConfig(&ctx, priv->xmlconf, nativeConfig);
if (def != NULL) {
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
@@ -2902,7 +2900,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
ctx.formatFileName = esxFormatVMXFileName;
ctx.autodetectSCSIControllerModel = esxAutodetectSCSIControllerModel;
- vmx = virVMXFormatConfig(&ctx, priv->caps, def, virtualHW_version);
+ vmx = virVMXFormatConfig(&ctx, priv->xmlconf, def, virtualHW_version);
virDomainDefFree(def);
@@ -3149,7 +3147,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
ctx.formatFileName = esxFormatVMXFileName;
ctx.autodetectSCSIControllerModel = esxAutodetectSCSIControllerModel;
- vmx = virVMXFormatConfig(&ctx, priv->caps, def, virtualHW_version);
+ vmx = virVMXFormatConfig(&ctx, priv->xmlconf, def, virtualHW_version);
if (vmx == NULL) {
goto cleanup;
diff --git a/src/libvirt_vmx.syms b/src/libvirt_vmx.syms
index 0b15f49..a29073f 100644
--- a/src/libvirt_vmx.syms
+++ b/src/libvirt_vmx.syms
@@ -4,6 +4,7 @@
# vmx/vmx.h
virVMXConvertToUTF8;
+virVMXDomainXMLConfInit;
virVMXEscapeHex;
virVMXFormatCDROM;
virVMXFormatConfig;
@@ -22,6 +23,7 @@ virVMXParseSerial;
virVMXParseVNC;
virVMXUnescapeHex;
+
# Let emacs know we want case-insensitive sorting
# Local Variables:
# sort-fold-case: t
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dc49d44..ea99d69 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7743,7 +7743,7 @@ error:
* Will fail if not using the 'index' keyword
*/
static virDomainDiskDefPtr
-qemuParseCommandLineDisk(virCapsPtr qemuCaps,
+qemuParseCommandLineDisk(virDomainXMLConfPtr xmlconf,
const char *val,
int nvirtiodisk,
bool old_style_ceph_args)
@@ -8063,7 +8063,7 @@ qemuParseCommandLineDisk(virCapsPtr qemuCaps,
else
def->dst[2] = 'a' + idx;
- if (virDomainDiskDefAssignAddress(qemuCaps, def) < 0) {
+ if (virDomainDiskDefAssignAddress(xmlconf, def) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid device name '%s'"), def->dst);
virDomainDiskDefFree(def);
@@ -9147,7 +9147,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
!disk->dst)
goto no_memory;
- if (virDomainDiskDefAssignAddress(qemuCaps, disk) < 0) {
+ if (virDomainDiskDefAssignAddress(xmlconf, disk) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot assign address for device name
'%s'"),
disk->dst);
@@ -9369,7 +9369,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
}
} else if (STREQ(arg, "-drive")) {
WANT_VALUE();
- if (!(disk = qemuParseCommandLineDisk(qemuCaps, val, nvirtiodisk,
+ if (!(disk = qemuParseCommandLineDisk(xmlconf, val,
+ nvirtiodisk,
ceph_args != NULL)))
goto error;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 19be62a..e5e8c40 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -174,7 +174,7 @@ vmwareLoadDomains(struct vmware_driver *driver)
goto cleanup;
if ((vmdef =
- virVMXParseConfig(&ctx, driver->caps, vmx)) == NULL) {
+ virVMXParseConfig(&ctx, driver->xmlconf, vmx)) == NULL) {
goto cleanup;
}
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index bf4c1ff..683abd5 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -330,7 +330,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
goto cleanup;
/* generate vmx file */
- vmx = virVMXFormatConfig(&ctx, driver->caps, vmdef, 7);
+ vmx = virVMXFormatConfig(&ctx, driver->xmlconf, vmdef, 7);
if (vmx == NULL)
goto cleanup;
@@ -601,7 +601,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
goto cleanup;
/* generate vmx file */
- vmx = virVMXFormatConfig(&ctx, driver->caps, vmdef, 7);
+ vmx = virVMXFormatConfig(&ctx, driver->xmlconf, vmdef, 7);
if (vmx == NULL)
goto cleanup;
@@ -943,7 +943,7 @@ vmwareDomainXMLFromNative(virConnectPtr conn, const char
*nativeFormat,
ctx.parseFileName = vmwareCopyVMXFileName;
- def = virVMXParseConfig(&ctx, driver->caps, nativeConfig);
+ def = virVMXParseConfig(&ctx, driver->xmlconf, nativeConfig);
if (def != NULL)
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index c604bd2..1761a80 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -519,6 +519,18 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
* Helpers
*/
+virDomainDefParserConfig virVMXDomainDefParserConfig = {
+ .hasWideScsiBus = true,
+};
+
+
+virDomainXMLConfPtr
+virVMXDomainXMLConfInit(void)
+{
+ return virDomainXMLConfNew(&virVMXDomainDefParserConfig,
+ NULL, NULL);
+}
+
char *
virVMXEscapeHex(const char *string, char escape, const char *special)
{
@@ -934,7 +946,7 @@ virVMXFloppyDiskNameToUnit(const char *name, int *unit)
static int
-virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk)
+virVMXVerifyDiskAddress(virDomainXMLConfPtr xmlconf, virDomainDiskDefPtr disk)
{
virDomainDiskDef def;
virDomainDeviceDriveAddressPtr drive;
@@ -953,7 +965,7 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk)
def.dst = disk->dst;
def.bus = disk->bus;
- if (virDomainDiskDefAssignAddress(caps, &def) < 0) {
+ if (virDomainDiskDefAssignAddress(xmlconf, &def) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not verify disk address"));
return -1;
@@ -1210,7 +1222,9 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr
def,
*/
virDomainDefPtr
-virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
+virVMXParseConfig(virVMXContext *ctx,
+ virDomainXMLConfPtr xmlconf,
+ const char *vmx)
{
bool success = false;
virConfPtr conf = NULL;
@@ -1587,7 +1601,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
continue;
}
- if (virVMXParseDisk(ctx, caps, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+ if (virVMXParseDisk(ctx, xmlconf, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
VIR_DOMAIN_DISK_BUS_SCSI, controller, unit,
&def->disks[def->ndisks]) < 0) {
goto cleanup;
@@ -1598,7 +1612,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
continue;
}
- if (virVMXParseDisk(ctx, caps, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+ if (virVMXParseDisk(ctx, xmlconf, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
VIR_DOMAIN_DISK_BUS_SCSI, controller, unit,
&def->disks[def->ndisks]) < 0) {
goto cleanup;
@@ -1613,7 +1627,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
/* def:disks (ide) */
for (bus = 0; bus < 2; ++bus) {
for (unit = 0; unit < 2; ++unit) {
- if (virVMXParseDisk(ctx, caps, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+ if (virVMXParseDisk(ctx, xmlconf, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
VIR_DOMAIN_DISK_BUS_IDE, bus, unit,
&def->disks[def->ndisks]) < 0) {
goto cleanup;
@@ -1624,7 +1638,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
continue;
}
- if (virVMXParseDisk(ctx, caps, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+ if (virVMXParseDisk(ctx, xmlconf, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
VIR_DOMAIN_DISK_BUS_IDE, bus, unit,
&def->disks[def->ndisks]) < 0) {
goto cleanup;
@@ -1638,7 +1652,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char
*vmx)
/* def:disks (floppy) */
for (unit = 0; unit < 2; ++unit) {
- if (virVMXParseDisk(ctx, caps, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
+ if (virVMXParseDisk(ctx, xmlconf, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
VIR_DOMAIN_DISK_BUS_FDC, 0, unit,
&def->disks[def->ndisks]) < 0) {
goto cleanup;
@@ -1949,7 +1963,7 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool
*present,
int
-virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf,
+virVMXParseDisk(virVMXContext *ctx, virDomainXMLConfPtr xmlconf, virConfPtr conf,
int device, int busType, int controllerOrBus, int unit,
virDomainDiskDefPtr *def)
{
@@ -2283,7 +2297,7 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr
conf,
goto cleanup;
}
- if (virDomainDiskDefAssignAddress(caps, *def) < 0) {
+ if (virDomainDiskDefAssignAddress(xmlconf, *def) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not assign address to disk '%s'"),
(*def)->src);
goto cleanup;
@@ -3021,7 +3035,7 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def)
*/
char *
-virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
+virVMXFormatConfig(virVMXContext *ctx, virDomainXMLConfPtr xmlconf, virDomainDefPtr def,
int virtualHW_version)
{
char *vmx = NULL;
@@ -3230,7 +3244,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
virDomainDefPtr def,
/* def:disks */
for (i = 0; i < def->ndisks; ++i) {
- if (virVMXVerifyDiskAddress(caps, def->disks[i]) < 0 ||
+ if (virVMXVerifyDiskAddress(xmlconf, def->disks[i]) < 0 ||
virVMXHandleLegacySCSIDiskDriverName(def, def->disks[i]) < 0) {
goto cleanup;
}
diff --git a/src/vmx/vmx.h b/src/vmx/vmx.h
index f4877b1..b9d623d 100644
--- a/src/vmx/vmx.h
+++ b/src/vmx/vmx.h
@@ -29,6 +29,7 @@
typedef struct _virVMXContext virVMXContext;
+virDomainXMLConfPtr virVMXDomainXMLConfInit(void);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -78,7 +79,8 @@ char *virVMXConvertToUTF8(const char *encoding, const char *string);
* VMX -> Domain XML
*/
-virDomainDefPtr virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps,
+virDomainDefPtr virVMXParseConfig(virVMXContext *ctx,
+ virDomainXMLConfPtr xmlconf,
const char *vmx);
int virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
@@ -86,9 +88,9 @@ int virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
int virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
int *virtualDev);
-int virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf,
- int device, int busType, int controllerOrBus, int unit,
- virDomainDiskDefPtr *def);
+int virVMXParseDisk(virVMXContext *ctx, virDomainXMLConfPtr xmlconf,
+ virConfPtr conf, int device, int busType,
+ int controllerOrBus, int unit, virDomainDiskDefPtr *def);
int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def);
@@ -108,7 +110,7 @@ int virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def);
* Domain XML -> VMX
*/
-char *virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps,
+char *virVMXFormatConfig(virVMXContext *ctx, virDomainXMLConfPtr xmlconf,
virDomainDefPtr def, int virtualHW_version);
int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index cee4c39..d73c6d2 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -12,6 +12,7 @@
# include "vmx/vmx.h"
static virCapsPtr caps;
+static virDomainXMLConfPtr xmlconf;
static virVMXContext ctx;
static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
@@ -20,6 +21,7 @@ static int testDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
}
+
static void
testCapsInit(void)
{
@@ -36,8 +38,6 @@ testCapsInit(void)
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
virCapabilitiesAddHostMigrateTransport(caps, "esx");
- caps->hasWideScsiBus = true;
-
/* i686 guest */
guest =
virCapabilitiesAddGuest(caps, "hvm",
@@ -93,7 +93,7 @@ testCompareFiles(const char *vmx, const char *xml)
goto failure;
}
- def = virVMXParseConfig(&ctx, caps, vmxData);
+ def = virVMXParseConfig(&ctx, xmlconf, vmxData);
if (def == NULL) {
err = virGetLastError();
@@ -221,6 +221,9 @@ mymain(void)
return EXIT_FAILURE;
}
+ if (!(xmlconf = virVMXDomainXMLConfInit()))
+ return EXIT_FAILURE;
+
ctx.opaque = NULL;
ctx.parseFileName = testParseVMXFileName;
ctx.formatFileName = NULL;
@@ -296,6 +299,7 @@ mymain(void)
DO_TEST("svga", "svga");
virObjectUnref(caps);
+ virObjectUnref(xmlconf);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index c606036..303cb22 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -37,7 +37,6 @@ testCapsInit(void)
virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 });
virCapabilitiesAddHostMigrateTransport(caps, "esx");
- caps->hasWideScsiBus = true;
/* i686 guest */
guest =
@@ -73,7 +72,6 @@ testCapsInit(void)
failure:
virObjectUnref(caps);
- virObjectUnref(xmlconf);
caps = NULL;
}
@@ -102,7 +100,7 @@ testCompareFiles(const char *xml, const char *vmx, int
virtualHW_version)
goto failure;
}
- formatted = virVMXFormatConfig(&ctx, caps, def, virtualHW_version);
+ formatted = virVMXFormatConfig(&ctx, xmlconf, def, virtualHW_version);
if (formatted == NULL) {
goto failure;
@@ -240,7 +238,7 @@ mymain(void)
return EXIT_FAILURE;
}
- if (!(xmlconf = virDomainXMLConfNew(NULL, NULL, NULL)))
+ if (!(xmlconf = virVMXDomainXMLConfInit()))
return EXIT_FAILURE;
ctx.opaque = NULL;
@@ -312,6 +310,7 @@ mymain(void)
DO_TEST("svga", "svga", 4);
virObjectUnref(caps);
+ virObjectUnref(xmlconf);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
1.8.1.5