separate virDomainDefParsePanicInfo from virDomainDefParseXML, move virDomainDefParsePanicInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 52 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d19d4de..412e59c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20758,6 +20758,41 @@ virDomainDefParseRedirFilterInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParsePanicInfo(virDomainParseTotalParamPtr param) +{ + virDomainDefPtr def = param->def; + xmlXPathContextPtr ctxt = param->ctxt; + virDomainXMLOptionPtr xmlopt = param->xmlopt; + unsigned int flags = param->flags; + + int ret = -1; + int n = 0; + size_t i; + xmlNodePtr *nodes = NULL; + + /* analysis of the panic devices */ + if ((n = virXPathNodeSet("./devices/panic", ctxt, &nodes)) < 0) + goto cleanup; + if (n && VIR_ALLOC_N(def->panics, n) < 0) + goto cleanup; + for (i = 0; i < n; i++) { + virDomainPanicDefPtr panic; + + panic = virDomainPanicDefParseXML(xmlopt, nodes[i], flags); + if (!panic) + goto cleanup; + + def->panics[def->npanics++] = panic; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -20788,6 +20823,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseHubInfo, virDomainDefParseRedirdevInfo, virDomainDefParseRedirFilterInfo, + virDomainDefParsePanicInfo, NULL }; @@ -20890,22 +20926,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the panic devices */ - if ((n = virXPathNodeSet("./devices/panic", ctxt, &nodes)) < 0) - goto error; - if (n && VIR_ALLOC_N(def->panics, n) < 0) - goto error; - for (i = 0; i < n; i++) { - virDomainPanicDefPtr panic; - - panic = virDomainPanicDefParseXML(xmlopt, nodes[i], flags); - if (!panic) - goto error; - - def->panics[def->npanics++] = panic; - } - VIR_FREE(nodes); - /* analysis of the shmem devices */ if ((n = virXPathNodeSet("./devices/shmem", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list