separate virDomainDefParseFilesystemInfo from virDomainDefParseXML, move virDomainDefParseFilesystemInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 54 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6a27294..72ddbd7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19945,6 +19945,42 @@ virDomainDefParseLeaseInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParseFilesystemInfo(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 filesystems */ + if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0) + goto cleanup; + if (n && VIR_ALLOC_N(def->fss, n) < 0) + goto cleanup; + for (i = 0; i < n; i++) { + virDomainFSDefPtr fs = virDomainFSDefParseXML(xmlopt, + nodes[i], + ctxt, + flags); + if (!fs) + goto cleanup; + + def->fss[def->nfss++] = fs; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -19955,6 +19991,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseControllerInfo, virDomainDefParseDisksInfo, virDomainDefParseLeaseInfo, + virDomainDefParseFilesystemInfo, NULL }; @@ -20059,23 +20096,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the filesystems */ - if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0) - goto error; - if (n && VIR_ALLOC_N(def->fss, n) < 0) - goto error; - for (i = 0; i < n; i++) { - virDomainFSDefPtr fs = virDomainFSDefParseXML(xmlopt, - nodes[i], - ctxt, - flags); - if (!fs) - goto error; - - def->fss[def->nfss++] = fs; - } - VIR_FREE(nodes); - /* analysis of the network devices */ if ((n = virXPathNodeSet("./devices/interface", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list