'const fooPtr' is the same as 'foo * const' (the pointer won't change, but it's contents can). But in general, if an interface is trying to be const-correct, it should be using 'const foo *' (the pointer is to data that can't be changed). Fix up offenders in src/conf/domain_conf, and their fallout. Several things to note: virObjectLock() requires a non-const argument; if this were C++, we could treat the locking field as 'mutable' and allow locking an otherwise 'const' object, but that is a more invasive change, so I instead dropped attempts to be const-correct on domain lookup. virXMLPropString and friends require a non-const xmlNodePtr - this is because libxml2 is not a const-correct library. We could make the src/util/virxml wrappers cast away const, but I figured it was easier to not try to mark xmlNodePtr as const. Finally, virDomainDeviceDefCopy was a rather hard conversion - it calls virDomainDeviceDefPostParse, which in turn in the xen driver was actually modifying the domain outside of the current device being visited. We should not be adding a device on the first per-device callback, but waiting until after all per-device callbacks are complete. * src/conf/domain_conf.h (virDomainObjListFindByID) (virDomainObjListFindByUUID, virDomainObjListFindByName) (virDomainObjAssignDef, virDomainObjListAdd): Drop attempt at const. (virDomainDeviceDefCopy): Use intended type. (virDomainDeviceDefParse, virDomainDeviceDefPostParseCallback) (virDomainVideoDefaultType, virDomainVideoDefaultRAM) (virDomainChrGetDomainPtrs): Make const-correct. * src/conf/domain_conf.c (virDomainObjListFindByID) (virDomainObjListFindByUUID, virDomainObjListFindByName) (virDomainDeviceDefCopy, virDomainObjListAdd) (virDomainObjAssignDef, virDomainHostdevSubsysUsbDefParseXML) (virDomainHostdevSubsysPciOrigStatesDefParseXML) (virDomainHostdevSubsysPciDefParseXML) (virDomainHostdevSubsysScsiDefParseXML) (virDomainControllerModelTypeFromString) (virDomainTPMDefParseXML, virDomainTimerDefParseXML) (virDomainSoundCodecDefParseXML, virDomainSoundDefParseXML) (virDomainWatchdogDefParseXML, virDomainRNGDefParseXML) (virDomainMemballoonDefParseXML, virDomainNVRAMDefParseXML) (virSysinfoParseXML, virDomainVideoAccelDefParseXML) (virDomainVideoDefParseXML, virDomainHostdevDefParseXML) (virDomainRedirdevDefParseXML) (virDomainRedirFilterUsbDevDefParseXML) (virDomainRedirFilterDefParseXML, virDomainIdMapEntrySort) (virDomainIdmapDefParseXML, virDomainVcpuPinDefParseXML) (virDiskNameToBusDeviceIndex, virDomainDeviceDefCopy) (virDomainVideoDefaultType, virDomainHostdevAssignAddress) (virDomainDeviceDefPostParseInternal, virDomainDeviceDefPostParse) (virDomainChrGetDomainPtrs, virDomainControllerSCSINextUnit) (virDomainSCSIDriveAddressIsUsed) (virDomainDriveAddressIsUsedByDisk) (virDomainDriveAddressIsUsedByHostdev): Fix fallout. * src/openvz/openvz_driver.c (openvzDomainDeviceDefPostParse): Likewise. * src/libxl/libxl_domain.c (libxlDomainDeviceDefPostParse): Likewise. * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse) (qemuDomainDefaultNetModel): Likewise. * src/lxc/lxc_domain.c (virLXCDomainDeviceDefPostParse): Likewise. * src/uml/uml_driver.c (umlDomainDeviceDefPostParse): Likewise. * src/xen/xen_driver.c (xenDomainDeviceDefPostParse): Split... (xenDomainDefPostParse): ...since per-device callback is not the time to be adding a device. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/domain_conf.c | 94 ++++++++++++++++++++++++---------------------- src/conf/domain_conf.h | 24 +++++++----- src/libxl/libxl_domain.c | 2 +- src/lxc/lxc_domain.c | 4 +- src/openvz/openvz_driver.c | 2 +- src/qemu/qemu_domain.c | 5 ++- src/uml/uml_driver.c | 6 +-- src/xen/xen_driver.c | 12 +++++- 8 files changed, 84 insertions(+), 65 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8e1e644..c06c9d0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -990,7 +990,7 @@ static int virDomainObjListSearchID(const void *payload, return want; } -virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByID(virDomainObjListPtr doms, int id) { virDomainObjPtr obj; @@ -1003,7 +1003,7 @@ virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms, } -virDomainObjPtr virDomainObjListFindByUUID(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByUUID(virDomainObjListPtr doms, const unsigned char *uuid) { char uuidstr[VIR_UUID_STRING_BUFLEN]; @@ -1033,7 +1033,7 @@ static int virDomainObjListSearchName(const void *payload, return want; } -virDomainObjPtr virDomainObjListFindByName(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms, const char *name) { virDomainObjPtr obj; @@ -2091,7 +2091,7 @@ virDomainDefPtr virDomainDefNew(const char *name, void virDomainObjAssignDef(virDomainObjPtr domain, - const virDomainDefPtr def, + virDomainDefPtr def, bool live, virDomainDefPtr *oldDef) { @@ -2138,7 +2138,7 @@ void virDomainObjAssignDef(virDomainObjPtr domain, */ static virDomainObjPtr virDomainObjListAddLocked(virDomainObjListPtr doms, - const virDomainDefPtr def, + virDomainDefPtr def, virDomainXMLOptionPtr xmlopt, unsigned int flags, virDomainDefPtr *oldDef) @@ -2209,7 +2209,7 @@ error: virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms, - const virDomainDefPtr def, + virDomainDefPtr def, virDomainXMLOptionPtr xmlopt, unsigned int flags, virDomainDefPtr *oldDef) @@ -2802,7 +2802,7 @@ virDomainDefPostParseInternal(virDomainDefPtr def, static int virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED) { if (dev->type == VIR_DOMAIN_DEVICE_CHR) { @@ -2852,7 +2852,7 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, static int virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt) { @@ -3548,7 +3548,7 @@ virDomainParseLegacyDeviceAddress(char *devaddr, } static int -virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node, +virDomainHostdevSubsysUsbDefParseXML(xmlNodePtr node, virDomainHostdevDefPtr def) { @@ -3698,7 +3698,7 @@ out: * </origstates> */ static int -virDomainHostdevSubsysPciOrigStatesDefParseXML(const xmlNodePtr node, +virDomainHostdevSubsysPciOrigStatesDefParseXML(xmlNodePtr node, virDomainHostdevOrigStatesPtr def) { xmlNodePtr cur; @@ -3726,7 +3726,7 @@ virDomainHostdevSubsysPciOrigStatesDefParseXML(const xmlNodePtr node, } static int -virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node, +virDomainHostdevSubsysPciDefParseXML(xmlNodePtr node, virDomainHostdevDefPtr def, unsigned int flags) { @@ -3777,7 +3777,7 @@ out: } static int -virDomainHostdevSubsysScsiDefParseXML(const xmlNodePtr node, +virDomainHostdevSubsysScsiDefParseXML(xmlNodePtr node, virDomainHostdevDefPtr def) { int ret = -1; @@ -3868,7 +3868,7 @@ cleanup: * taken by a disk or not. */ static bool -virDomainDriveAddressIsUsedByDisk(virDomainDefPtr def, +virDomainDriveAddressIsUsedByDisk(const virDomainDef *def, enum virDomainDiskBus type, unsigned int controller, unsigned int unit) @@ -3897,7 +3897,7 @@ virDomainDriveAddressIsUsedByDisk(virDomainDefPtr def, * taken by a host device or not. */ static bool -virDomainDriveAddressIsUsedByHostdev(virDomainDefPtr def, +virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def, enum virDomainHostdevSubsysType type, unsigned int controller, unsigned int unit) @@ -3922,7 +3922,7 @@ virDomainDriveAddressIsUsedByHostdev(virDomainDefPtr def, } static bool -virDomainSCSIDriveAddressIsUsed(virDomainDefPtr def, +virDomainSCSIDriveAddressIsUsed(const virDomainDef *def, unsigned int controller, unsigned int unit) { @@ -3943,7 +3943,7 @@ virDomainSCSIDriveAddressIsUsed(virDomainDefPtr def, /* Find out the next usable "unit" of a specific controller */ static int -virDomainControllerSCSINextUnit(virDomainDefPtr def, +virDomainControllerSCSINextUnit(const virDomainDef *def, unsigned int max_unit, unsigned int controller) { @@ -3962,7 +3962,7 @@ virDomainControllerSCSINextUnit(virDomainDefPtr def, static int virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt, - virDomainDefPtr def, + const virDomainDef *def, virDomainHostdevDefPtr hostdev) { int next_unit = 0; @@ -5694,7 +5694,7 @@ cleanup: static int -virDomainControllerModelTypeFromString(const virDomainControllerDefPtr def, +virDomainControllerModelTypeFromString(const virDomainControllerDef *def, const char *model) { if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) @@ -7381,7 +7381,7 @@ error: * */ static virDomainTPMDefPtr -virDomainTPMDefParseXML(const xmlNodePtr node, +virDomainTPMDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, unsigned int flags) { @@ -7606,7 +7606,7 @@ error: /* Parse the XML definition for a clock timer */ static virDomainTimerDefPtr -virDomainTimerDefParseXML(const xmlNodePtr node, +virDomainTimerDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt) { char *name = NULL; @@ -8406,7 +8406,7 @@ error: static virDomainSoundCodecDefPtr -virDomainSoundCodecDefParseXML(const xmlNodePtr node) +virDomainSoundCodecDefParseXML(xmlNodePtr node) { char *type; virDomainSoundCodecDefPtr def; @@ -8434,7 +8434,7 @@ error: static virDomainSoundDefPtr -virDomainSoundDefParseXML(const xmlNodePtr node, +virDomainSoundDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, unsigned int flags) { @@ -8503,7 +8503,7 @@ error: static virDomainWatchdogDefPtr -virDomainWatchdogDefParseXML(const xmlNodePtr node, +virDomainWatchdogDefParseXML(xmlNodePtr node, unsigned int flags) { @@ -8556,7 +8556,7 @@ error: static virDomainRNGDefPtr -virDomainRNGDefParseXML(const xmlNodePtr node, +virDomainRNGDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, unsigned int flags) { @@ -8677,7 +8677,7 @@ error: static virDomainMemballoonDefPtr -virDomainMemballoonDefParseXML(const xmlNodePtr node, +virDomainMemballoonDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, unsigned int flags) { @@ -8724,7 +8724,7 @@ error: } static virDomainNVRAMDefPtr -virDomainNVRAMDefParseXML(const xmlNodePtr node, +virDomainNVRAMDefParseXML(xmlNodePtr node, unsigned int flags) { virDomainNVRAMDefPtr def; @@ -8743,7 +8743,7 @@ error: } static virSysinfoDefPtr -virSysinfoParseXML(const xmlNodePtr node, +virSysinfoParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, unsigned char *domUUID, bool uuid_generated) @@ -8860,7 +8860,7 @@ error: } int -virDomainVideoDefaultRAM(virDomainDefPtr def, +virDomainVideoDefaultRAM(const virDomainDef *def, int type) { switch (type) { @@ -8891,7 +8891,7 @@ virDomainVideoDefaultRAM(virDomainDefPtr def, int -virDomainVideoDefaultType(virDomainDefPtr def) +virDomainVideoDefaultType(const virDomainDef *def) { switch (def->virtType) { case VIR_DOMAIN_VIRT_TEST: @@ -8920,7 +8920,8 @@ virDomainVideoDefaultType(virDomainDefPtr def) } static virDomainVideoAccelDefPtr -virDomainVideoAccelDefParseXML(const xmlNodePtr node) { +virDomainVideoAccelDefParseXML(xmlNodePtr node) +{ xmlNodePtr cur; virDomainVideoAccelDefPtr def; char *support3d = NULL; @@ -8964,8 +8965,8 @@ virDomainVideoAccelDefParseXML(const xmlNodePtr node) { } static virDomainVideoDefPtr -virDomainVideoDefParseXML(const xmlNodePtr node, - virDomainDefPtr dom, +virDomainVideoDefParseXML(xmlNodePtr node, + const virDomainDef *dom, unsigned int flags) { virDomainVideoDefPtr def; @@ -9071,8 +9072,8 @@ error: static virDomainHostdevDefPtr virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt, - virDomainDefPtr vmdef, - const xmlNodePtr node, + const virDomainDef *vmdef, + xmlNodePtr node, xmlXPathContextPtr ctxt, virHashTablePtr bootHash, unsigned int flags) @@ -9162,7 +9163,7 @@ error: static virDomainRedirdevDefPtr -virDomainRedirdevDefParseXML(const xmlNodePtr node, +virDomainRedirdevDefParseXML(xmlNodePtr node, virHashTablePtr bootHash, unsigned int flags) { @@ -9299,7 +9300,7 @@ cleanup: } static virDomainRedirFilterUsbDevDefPtr -virDomainRedirFilterUsbDevDefParseXML(const xmlNodePtr node) +virDomainRedirFilterUsbDevDefParseXML(xmlNodePtr node) { char *class; char *vendor = NULL, *product = NULL; @@ -9390,7 +9391,7 @@ error: } static virDomainRedirFilterDefPtr -virDomainRedirFilterDefParseXML(const xmlNodePtr node, +virDomainRedirFilterDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt) { int n; @@ -9477,7 +9478,7 @@ virDomainPMStateParseXML(xmlXPathContextPtr ctxt, virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, unsigned int flags) @@ -10330,6 +10331,7 @@ virDomainChrGetDomainPtrsInternal(virDomainDefPtr vmdef, } } + /* Return the array within vmdef that can contain a chrdefptr of the * given type. */ void @@ -10353,6 +10355,7 @@ virDomainChrGetDomainPtrs(const virDomainDef *vmdef, } } + int virDomainChrInsert(virDomainDefPtr vmdef, virDomainChrDefPtr chr) @@ -10531,8 +10534,8 @@ cleanup: static int virDomainIdMapEntrySort(const void *a, const void *b) { - const virDomainIdMapEntryPtr entrya = (const virDomainIdMapEntryPtr) a; - const virDomainIdMapEntryPtr entryb = (const virDomainIdMapEntryPtr) b; + const virDomainIdMapEntry *entrya = a; + const virDomainIdMapEntry *entryb = b; if (entrya->start > entryb->start) return 1; @@ -10551,7 +10554,7 @@ static int virDomainIdMapEntrySort(const void *a, const void *b) */ static virDomainIdMapEntryPtr virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, - const xmlNodePtr *node, + xmlNodePtr *node, size_t num) { size_t i; @@ -10602,7 +10605,7 @@ cleanup: * have to check the returned cpuid for validity. */ static virDomainVcpuPinDefPtr -virDomainVcpuPinDefParseXML(const xmlNodePtr node, +virDomainVcpuPinDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, int maxvcpus, int emulator) @@ -17435,9 +17438,10 @@ char * @return 0 on success, -1 on failure */ int -virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk, +virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk, int *busIdx, - int *devIdx) { + int *devIdx) +{ int idx = virDiskNameToIndex(disk->dst); if (idx < 0) @@ -18243,7 +18247,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device) */ virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src, - const virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 779a429..01c0116 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2130,11 +2130,15 @@ typedef void (*virDomainXMLPrivateDataFreeFunc)(void *); typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, void *); typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, void *); +/* Called once after everything else has been parsed, for adjusting + * overall domain defaults. */ typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def, virCapsPtr caps, void *opaque); +/* Called once per device, for adjusting per-device settings while + * leaving the overall domain otherwise unchanged. */ typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, void *opaque); @@ -2189,11 +2193,11 @@ virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps) virDomainObjListPtr virDomainObjListNew(void); -virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByID(virDomainObjListPtr doms, int id); -virDomainObjPtr virDomainObjListFindByUUID(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByUUID(virDomainObjListPtr doms, const unsigned char *uuid); -virDomainObjPtr virDomainObjListFindByName(const virDomainObjListPtr doms, +virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms, const char *name); bool virDomainObjTaint(virDomainObjPtr obj, @@ -2234,7 +2238,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def); void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def); void virDomainDeviceDefFree(virDomainDeviceDefPtr def); virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src, - const virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt); int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, @@ -2269,12 +2273,12 @@ enum { VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1), }; virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms, - const virDomainDefPtr def, + virDomainDefPtr def, virDomainXMLOptionPtr xmlopt, unsigned int flags, virDomainDefPtr *oldDef); void virDomainObjAssignDef(virDomainObjPtr domain, - const virDomainDefPtr def, + virDomainDefPtr def, bool live, virDomainDefPtr *oldDef); int virDomainObjSetDefTransient(virCapsPtr caps, @@ -2307,7 +2311,7 @@ void virDomainObjListRemoveLocked(virDomainObjListPtr doms, virDomainObjPtr dom); virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, unsigned int flags); @@ -2494,8 +2498,8 @@ int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk, virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def); int virDomainFSIndexByName(virDomainDefPtr def, const char *name); -int virDomainVideoDefaultType(virDomainDefPtr def); -int virDomainVideoDefaultRAM(virDomainDefPtr def, int type); +int virDomainVideoDefaultType(const virDomainDef *def); +int virDomainVideoDefaultRAM(const virDomainDef *def, int type); int virDomainObjListNumOfDomains(virDomainObjListPtr doms, bool active, diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 0abf80b..68009db 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -383,7 +383,7 @@ virDomainXMLPrivateDataCallbacks libxlDomainXMLPrivateDataCallbacks = { static int libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 31f6e84..83c5a4e 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 Red Hat, Inc. + * Copyright (C) 2010-2013 Red Hat, Inc. * Copyright IBM Corp. 2008 * * lxc_domain.h: LXC domain helpers @@ -98,7 +98,7 @@ virLXCDomainDefPostParse(virDomainDefPtr def, static int virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def ATTRIBUTE_UNUSED, + const virDomainDef *def ATTRIBUTE_UNUSED, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index d268647..df55568 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -102,7 +102,7 @@ openvzDomainDefPostParse(virDomainDefPtr def, static int openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def ATTRIBUTE_UNUSED, + const virDomainDef *def ATTRIBUTE_UNUSED, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 968e323..ff5fddf 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -787,7 +787,8 @@ qemuDomainDefPostParse(virDomainDefPtr def, } static const char * -qemuDomainDefaultNetModel(virDomainDefPtr def) { +qemuDomainDefaultNetModel(const virDomainDef *def) +{ if (def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X) return "virtio"; @@ -806,7 +807,7 @@ qemuDomainDefaultNetModel(virDomainDefPtr def) { static int qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque) { diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index eb02542..b9b977a 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -419,9 +419,9 @@ cleanup: static int umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def ATTRIBUTE_UNUSED, - virCapsPtr caps ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED) + const virDomainDef *def ATTRIBUTE_UNUSED, + virCapsPtr caps ATTRIBUTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) { if (dev->type == VIR_DOMAIN_DEVICE_CHR && dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 40b98ee..9ba1b10 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -330,7 +330,7 @@ xenUnifiedXendProbe(void) static int xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, - virDomainDefPtr def, + const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { @@ -340,6 +340,15 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, STRNEQ(def->os.type, "hvm")) dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; + return 0; +} + + +static int +xenDomainDefPostParse(virDomainDefPtr def, + virCapsPtr caps ATTRIBUTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) +{ if (!def->memballoon) { virDomainMemballoonDefPtr memballoon; if (VIR_ALLOC(memballoon) < 0) @@ -356,6 +365,7 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, virDomainDefParserConfig xenDomainDefParserConfig = { .macPrefix = { 0x00, 0x16, 0x3e }, .devicesPostParseCallback = xenDomainDeviceDefPostParse, + .domainPostParseCallback = xenDomainDefPostParse, }; -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list