conf: Pass xmlopt down to virDomainDeviceInfoParseXML

This function is going to make decisions based on the features
set per each driver. For that we need the virDomainXMLOption
object.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2017-10-18 15:30:07 +02:00
parent 6bc4a371cf
commit eebfdcb41e

View File

@ -6458,7 +6458,8 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
* @param node XML nodeset to parse for device address definition * @param node XML nodeset to parse for device address definition
*/ */
static int static int
virDomainDeviceInfoParseXML(xmlNodePtr node, virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED,
xmlNodePtr node,
virHashTablePtr bootHash, virHashTablePtr bootHash,
virDomainDeviceInfoPtr info, virDomainDeviceInfoPtr info,
unsigned int flags) unsigned int flags)
@ -9233,7 +9234,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else { } else {
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info, if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0) flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0)
goto error; goto error;
} }
@ -9570,7 +9571,8 @@ virDomainControllerModelTypeToString(virDomainControllerDefPtr def,
* @param node XML nodeset to parse for controller definition * @param node XML nodeset to parse for controller definition
*/ */
static virDomainControllerDefPtr static virDomainControllerDefPtr
virDomainControllerDefParseXML(xmlNodePtr node, virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -9719,7 +9721,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
def->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { def->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
VIR_DEBUG("Ignoring device address for none model usb controller"); VIR_DEBUG("Ignoring device address for none model usb controller");
} else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) { } else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL,
&def->info, flags) < 0) {
goto error; goto error;
} }
@ -9946,7 +9949,8 @@ virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt,
* @param node XML nodeset to parse for disk definition * @param node XML nodeset to parse for disk definition
*/ */
static virDomainFSDefPtr static virDomainFSDefPtr
virDomainFSDefParseXML(xmlNodePtr node, virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -10103,7 +10107,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
def->dst = target; def->dst = target;
target = NULL; target = NULL;
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
cleanup: cleanup:
@ -10624,7 +10628,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else { } else {
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info, if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0) | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0)
goto error; goto error;
@ -11891,7 +11895,8 @@ virDomainChrDefParseXML(virDomainXMLOptionPtr xmlopt,
if (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && if (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD) { def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD) {
VIR_DEBUG("Ignoring device address for gustfwd channel"); VIR_DEBUG("Ignoring device address for gustfwd channel");
} else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) { } else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL,
&def->info, flags) < 0) {
goto error; goto error;
} }
@ -12028,7 +12033,7 @@ virDomainSmartcardDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) { def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) {
@ -12061,7 +12066,8 @@ virDomainSmartcardDefParseXML(virDomainXMLOptionPtr xmlopt,
* *
*/ */
static virDomainTPMDefPtr static virDomainTPMDefPtr
virDomainTPMDefParseXML(xmlNodePtr node, virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -12130,7 +12136,7 @@ virDomainTPMDefParseXML(xmlNodePtr node,
goto error; goto error;
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
cleanup: cleanup:
@ -12149,7 +12155,8 @@ virDomainTPMDefParseXML(xmlNodePtr node,
} }
static virDomainPanicDefPtr static virDomainPanicDefPtr
virDomainPanicDefParseXML(xmlNodePtr node, virDomainPanicDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
unsigned int flags) unsigned int flags)
{ {
virDomainPanicDefPtr panic; virDomainPanicDefPtr panic;
@ -12158,7 +12165,8 @@ virDomainPanicDefParseXML(xmlNodePtr node,
if (VIR_ALLOC(panic) < 0) if (VIR_ALLOC(panic) < 0)
return NULL; return NULL;
if (virDomainDeviceInfoParseXML(node, NULL, &panic->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL,
&panic->info, flags) < 0)
goto error; goto error;
model = virXMLPropString(node, "model"); model = virXMLPropString(node, "model");
@ -12181,7 +12189,8 @@ virDomainPanicDefParseXML(xmlNodePtr node,
/* Parse the XML definition for an input device */ /* Parse the XML definition for an input device */
static virDomainInputDefPtr static virDomainInputDefPtr
virDomainInputDefParseXML(const virDomainDef *dom, virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt,
const virDomainDef *dom,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
@ -12292,7 +12301,7 @@ virDomainInputDefParseXML(const virDomainDef *dom,
} }
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
if (def->bus == VIR_DOMAIN_INPUT_BUS_USB && if (def->bus == VIR_DOMAIN_INPUT_BUS_USB &&
@ -12332,7 +12341,9 @@ virDomainInputDefParseXML(const virDomainDef *dom,
/* Parse the XML definition for a hub device */ /* Parse the XML definition for a hub device */
static virDomainHubDefPtr static virDomainHubDefPtr
virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags) virDomainHubDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
unsigned int flags)
{ {
virDomainHubDefPtr def; virDomainHubDefPtr def;
char *type = NULL; char *type = NULL;
@ -12354,7 +12365,7 @@ virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags)
goto error; goto error;
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
cleanup: cleanup:
@ -13431,7 +13442,8 @@ virDomainSoundCodecDefParseXML(xmlNodePtr node)
static virDomainSoundDefPtr static virDomainSoundDefPtr
virDomainSoundDefParseXML(xmlNodePtr node, virDomainSoundDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -13483,7 +13495,7 @@ virDomainSoundDefParseXML(xmlNodePtr node,
} }
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
cleanup: cleanup:
@ -13500,7 +13512,8 @@ virDomainSoundDefParseXML(xmlNodePtr node,
static virDomainWatchdogDefPtr static virDomainWatchdogDefPtr
virDomainWatchdogDefParseXML(xmlNodePtr node, virDomainWatchdogDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
unsigned int flags) unsigned int flags)
{ {
@ -13536,7 +13549,7 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
} }
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
cleanup: cleanup:
@ -13648,7 +13661,7 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt,
break; break;
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt), if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt),
@ -13671,7 +13684,8 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt,
static virDomainMemballoonDefPtr static virDomainMemballoonDefPtr
virDomainMemballoonDefParseXML(xmlNodePtr node, virDomainMemballoonDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -13717,7 +13731,8 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
if (def->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) if (def->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)
VIR_DEBUG("Ignoring device address for none model Memballoon"); VIR_DEBUG("Ignoring device address for none model Memballoon");
else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) else if (virDomainDeviceInfoParseXML(xmlopt, node, NULL,
&def->info, flags) < 0)
goto error; goto error;
if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt), if (virDomainVirtioOptionsParseXML(virXPathNode("./driver", ctxt),
@ -13738,7 +13753,8 @@ virDomainMemballoonDefParseXML(xmlNodePtr node,
} }
static virDomainNVRAMDefPtr static virDomainNVRAMDefPtr
virDomainNVRAMDefParseXML(xmlNodePtr node, virDomainNVRAMDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
unsigned int flags) unsigned int flags)
{ {
virDomainNVRAMDefPtr def; virDomainNVRAMDefPtr def;
@ -13746,7 +13762,7 @@ virDomainNVRAMDefParseXML(xmlNodePtr node,
if (VIR_ALLOC(def) < 0) if (VIR_ALLOC(def) < 0)
return NULL; return NULL;
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
return def; return def;
@ -13757,7 +13773,8 @@ virDomainNVRAMDefParseXML(xmlNodePtr node,
} }
static virDomainShmemDefPtr static virDomainShmemDefPtr
virDomainShmemDefParseXML(xmlNodePtr node, virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -13841,7 +13858,7 @@ virDomainShmemDefParseXML(xmlNodePtr node,
goto cleanup; goto cleanup;
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto cleanup; goto cleanup;
@ -14262,7 +14279,8 @@ virDomainVideoDriverDefParseXML(xmlNodePtr node)
} }
static virDomainVideoDefPtr static virDomainVideoDefPtr
virDomainVideoDefParseXML(xmlNodePtr node, virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
const virDomainDef *dom, const virDomainDef *dom,
unsigned int flags) unsigned int flags)
@ -14376,7 +14394,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
} }
} }
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags) < 0)
goto error; goto error;
def->driver = virDomainVideoDriverDefParseXML(node); def->driver = virDomainVideoDriverDefParseXML(node);
@ -14444,7 +14462,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
if (def->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { if (def->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
if (virDomainDeviceInfoParseXML(node, bootHash, def->info, if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0) | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0)
goto error; goto error;
@ -14531,7 +14549,7 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr xmlopt,
if (def->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) if (def->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC)
def->source->data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; def->source->data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
if (virDomainDeviceInfoParseXML(node, bootHash, &def->info, if (virDomainDeviceInfoParseXML(xmlopt, node, bootHash, &def->info,
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0) flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0)
goto error; goto error;
@ -14943,7 +14961,8 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
static virDomainMemoryDefPtr static virDomainMemoryDefPtr
virDomainMemoryDefParseXML(xmlNodePtr memdevNode, virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr memdevNode,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -14997,7 +15016,8 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode,
if (virDomainMemoryTargetDefParseXML(node, ctxt, def) < 0) if (virDomainMemoryTargetDefParseXML(node, ctxt, def) < 0)
goto error; goto error;
if (virDomainDeviceInfoParseXML(memdevNode, NULL, &def->info, flags) < 0) if (virDomainDeviceInfoParseXML(xmlopt, memdevNode,
NULL, &def->info, flags) < 0)
goto error; goto error;
ctxt->node = save; ctxt->node = save;
@ -15137,7 +15157,7 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_FS:
if (!(dev->data.fs = virDomainFSDefParseXML(node, ctxt, flags))) if (!(dev->data.fs = virDomainFSDefParseXML(xmlopt, node, ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_NET: case VIR_DOMAIN_DEVICE_NET:
@ -15147,20 +15167,23 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_INPUT:
if (!(dev->data.input = virDomainInputDefParseXML(def, node, if (!(dev->data.input = virDomainInputDefParseXML(xmlopt, def, node,
ctxt, flags))) ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_SOUND:
if (!(dev->data.sound = virDomainSoundDefParseXML(node, ctxt, flags))) if (!(dev->data.sound = virDomainSoundDefParseXML(xmlopt, node,
ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_WATCHDOG: case VIR_DOMAIN_DEVICE_WATCHDOG:
if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(node, flags))) if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(xmlopt,
node, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_VIDEO:
if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags))) if (!(dev->data.video = virDomainVideoDefParseXML(xmlopt, node,
ctxt, def, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_HOSTDEV: case VIR_DOMAIN_DEVICE_HOSTDEV:
@ -15170,8 +15193,8 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_CONTROLLER:
if (!(dev->data.controller = virDomainControllerDefParseXML(node, ctxt, if (!(dev->data.controller = virDomainControllerDefParseXML(xmlopt, node,
flags))) ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_GRAPHICS: case VIR_DOMAIN_DEVICE_GRAPHICS:
@ -15179,7 +15202,7 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_HUB: case VIR_DOMAIN_DEVICE_HUB:
if (!(dev->data.hub = virDomainHubDefParseXML(node, flags))) if (!(dev->data.hub = virDomainHubDefParseXML(xmlopt, node, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_REDIRDEV: case VIR_DOMAIN_DEVICE_REDIRDEV:
@ -15207,29 +15230,32 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_MEMBALLOON: case VIR_DOMAIN_DEVICE_MEMBALLOON:
if (!(dev->data.memballoon = virDomainMemballoonDefParseXML(node, if (!(dev->data.memballoon = virDomainMemballoonDefParseXML(xmlopt,
node,
ctxt, ctxt,
flags))) flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_NVRAM:
if (!(dev->data.nvram = virDomainNVRAMDefParseXML(node, flags))) if (!(dev->data.nvram = virDomainNVRAMDefParseXML(xmlopt, node, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_SHMEM:
if (!(dev->data.shmem = virDomainShmemDefParseXML(node, ctxt, flags))) if (!(dev->data.shmem = virDomainShmemDefParseXML(xmlopt, node,
ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_TPM: case VIR_DOMAIN_DEVICE_TPM:
if (!(dev->data.tpm = virDomainTPMDefParseXML(node, ctxt, flags))) if (!(dev->data.tpm = virDomainTPMDefParseXML(xmlopt, node, ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_PANIC:
if (!(dev->data.panic = virDomainPanicDefParseXML(node, flags))) if (!(dev->data.panic = virDomainPanicDefParseXML(xmlopt, node, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_MEMORY:
if (!(dev->data.memory = virDomainMemoryDefParseXML(node, ctxt, flags))) if (!(dev->data.memory = virDomainMemoryDefParseXML(xmlopt, node,
ctxt, flags)))
goto error; goto error;
break; break;
case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_IOMMU:
@ -18843,7 +18869,8 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i], virDomainControllerDefPtr controller = virDomainControllerDefParseXML(xmlopt,
nodes[i],
ctxt, ctxt,
flags); flags);
@ -18909,7 +18936,9 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->fss, n) < 0) if (n && VIR_ALLOC_N(def->fss, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainFSDefPtr fs = virDomainFSDefParseXML(nodes[i], ctxt, virDomainFSDefPtr fs = virDomainFSDefParseXML(xmlopt,
nodes[i],
ctxt,
flags); flags);
if (!fs) if (!fs)
goto error; goto error;
@ -19073,7 +19102,8 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainInputDefPtr input = virDomainInputDefParseXML(def, virDomainInputDefPtr input = virDomainInputDefParseXML(xmlopt,
def,
nodes[i], nodes[i],
ctxt, ctxt,
flags); flags);
@ -19115,7 +19145,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->sounds, n) < 0) if (n && VIR_ALLOC_N(def->sounds, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainSoundDefPtr sound = virDomainSoundDefParseXML(nodes[i], virDomainSoundDefPtr sound = virDomainSoundDefParseXML(xmlopt,
nodes[i],
ctxt, ctxt,
flags); flags);
if (!sound) if (!sound)
@ -19134,7 +19165,8 @@ virDomainDefParseXML(xmlDocPtr xml,
virDomainVideoDefPtr video; virDomainVideoDefPtr video;
ssize_t insertAt = -1; ssize_t insertAt = -1;
if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags))) if (!(video = virDomainVideoDefParseXML(xmlopt, nodes[i],
ctxt, def, flags)))
goto error; goto error;
if (video->primary) { if (video->primary) {
@ -19203,8 +19235,9 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
} }
if (n > 0) { if (n > 0) {
virDomainWatchdogDefPtr watchdog = virDomainWatchdogDefPtr watchdog;
virDomainWatchdogDefParseXML(nodes[0], flags);
watchdog = virDomainWatchdogDefParseXML(xmlopt, nodes[0], flags);
if (!watchdog) if (!watchdog)
goto error; goto error;
@ -19222,8 +19255,9 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
} }
if (n > 0) { if (n > 0) {
virDomainMemballoonDefPtr memballoon = virDomainMemballoonDefPtr memballoon;
virDomainMemballoonDefParseXML(nodes[0], ctxt, flags);
memballoon = virDomainMemballoonDefParseXML(xmlopt, nodes[0], ctxt, flags);
if (!memballoon) if (!memballoon)
goto error; goto error;
@ -19257,7 +19291,7 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
if (n > 0) { if (n > 0) {
if (!(def->tpm = virDomainTPMDefParseXML(nodes[0], ctxt, flags))) if (!(def->tpm = virDomainTPMDefParseXML(xmlopt, nodes[0], ctxt, flags)))
goto error; goto error;
} }
VIR_FREE(nodes); VIR_FREE(nodes);
@ -19271,7 +19305,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
} else if (n == 1) { } else if (n == 1) {
virDomainNVRAMDefPtr nvram = virDomainNVRAMDefPtr nvram =
virDomainNVRAMDefParseXML(nodes[0], flags); virDomainNVRAMDefParseXML(xmlopt, nodes[0], flags);
if (!nvram) if (!nvram)
goto error; goto error;
def->nvram = nvram; def->nvram = nvram;
@ -19284,7 +19318,9 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->hubs, n) < 0) if (n && VIR_ALLOC_N(def->hubs, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainHubDefPtr hub = virDomainHubDefParseXML(nodes[i], flags); virDomainHubDefPtr hub;
hub = virDomainHubDefParseXML(xmlopt, nodes[i], flags);
if (!hub) if (!hub)
goto error; goto error;
@ -19340,7 +19376,9 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->panics, n) < 0) if (n && VIR_ALLOC_N(def->panics, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainPanicDefPtr panic = virDomainPanicDefParseXML(nodes[i], flags); virDomainPanicDefPtr panic;
panic = virDomainPanicDefParseXML(xmlopt, nodes[i], flags);
if (!panic) if (!panic)
goto error; goto error;
@ -19358,7 +19396,7 @@ virDomainDefParseXML(xmlDocPtr xml,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainShmemDefPtr shmem; virDomainShmemDefPtr shmem;
ctxt->node = nodes[i]; ctxt->node = nodes[i];
shmem = virDomainShmemDefParseXML(nodes[i], ctxt, flags); shmem = virDomainShmemDefParseXML(xmlopt, nodes[i], ctxt, flags);
if (!shmem) if (!shmem)
goto error; goto error;
@ -19374,7 +19412,8 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
virDomainMemoryDefPtr mem = virDomainMemoryDefParseXML(nodes[i], virDomainMemoryDefPtr mem = virDomainMemoryDefParseXML(xmlopt,
nodes[i],
ctxt, ctxt,
flags); flags);
if (!mem) if (!mem)