separate virDomainDefParseIommuInfo from virDomainDefParseXML,
move virDomainDefParseIommuInfo into virDomainDefParseDeviceInfo
---
src/conf/domain_conf.c | 47 ++++++++++++++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 15 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7d8b875..e6498c3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20868,6 +20868,37 @@ virDomainDefParseDeviceMemInfo(virDomainParseTotalParamPtr
param)
static int
+virDomainDefParseIommuInfo(virDomainParseTotalParamPtr param)
+{
+ virDomainDefPtr def = param->def;
+ xmlXPathContextPtr ctxt = param->ctxt;
+
+ int ret = -1;
+ int n = 0;
+ xmlNodePtr *nodes = NULL;
+
+ if ((n = virXPathNodeSet("./devices/iommu", ctxt, &nodes)) < 0)
+ goto cleanup;
+
+ if (n > 1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("only a single IOMMU device is supported"));
+ goto cleanup;
+ }
+
+ if (n > 0) {
+ if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0], ctxt)))
+ goto cleanup;
+ }
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(nodes);
+ return ret;
+}
+
+
+static int
virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
{
typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param);
@@ -20901,6 +20932,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param)
virDomainDefParsePanicInfo,
virDomainDefParseShmemInfo,
virDomainDefParseDeviceMemInfo,
+ virDomainDefParseIommuInfo,
NULL
};
@@ -21002,21 +21034,6 @@ virDomainDefParseXML(xmlDocPtr xml,
fun_index++;
}
- if ((n = virXPathNodeSet("./devices/iommu", ctxt, &nodes)) < 0)
- goto error;
-
- if (n > 1) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("only a single IOMMU device is supported"));
- goto error;
- }
-
- if (n > 0) {
- if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0], ctxt)))
- goto error;
- }
- VIR_FREE(nodes);
-
/* analysis of the user namespace mapping */
if ((n = virXPathNodeSet("./idmap/uid", ctxt, &nodes)) < 0)
goto error;
--
2.8.3