mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
conf: Extract parsing of storage source related data
Split out the parser and separate it from the private data part so that it can be later reused in other parts of the code. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b17573fe09
commit
07141541fb
@ -8554,24 +8554,26 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
virDomainDiskSourcePrivateDataParse(xmlNodePtr node,
|
||||||
|
xmlXPathContextPtr ctxt,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
unsigned int flags,
|
unsigned int flags,
|
||||||
virDomainXMLOptionPtr xmlopt)
|
virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
xmlNodePtr saveNode = ctxt->node;
|
xmlNodePtr saveNode = ctxt->node;
|
||||||
xmlNodePtr node;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_STATUS) ||
|
if (!(flags & VIR_DOMAIN_DEF_PARSE_STATUS) ||
|
||||||
!xmlopt || !xmlopt->privateData.storageParse)
|
!xmlopt || !xmlopt->privateData.storageParse)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(node = virXPathNode("./privateData", ctxt)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
|
if (!(ctxt->node = virXPathNode("./privateData", ctxt))) {
|
||||||
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (xmlopt->privateData.storageParse(ctxt, src) < 0)
|
if (xmlopt->privateData.storageParse(ctxt, src) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -8584,12 +8586,11 @@ virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
virDomainDiskSourceParse(xmlNodePtr node,
|
virDomainStorageSourceParse(xmlNodePtr node,
|
||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
unsigned int flags,
|
unsigned int flags)
|
||||||
virDomainXMLOptionPtr xmlopt)
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
xmlNodePtr saveNode = ctxt->node;
|
xmlNodePtr saveNode = ctxt->node;
|
||||||
@ -8635,9 +8636,6 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
|||||||
ctxt, flags) < 0)
|
ctxt, flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* People sometimes pass a bogus '' source path when they mean to omit the
|
/* People sometimes pass a bogus '' source path when they mean to omit the
|
||||||
* source element completely (e.g. CDROM without media). This is just a
|
* source element completely (e.g. CDROM without media). This is just a
|
||||||
* little compatibility check to help those broken apps */
|
* little compatibility check to help those broken apps */
|
||||||
@ -8652,6 +8650,23 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virDomainDiskSourceParse(xmlNodePtr node,
|
||||||
|
xmlXPathContextPtr ctxt,
|
||||||
|
virStorageSourcePtr src,
|
||||||
|
unsigned int flags,
|
||||||
|
virDomainXMLOptionPtr xmlopt)
|
||||||
|
{
|
||||||
|
if (virDomainStorageSourceParse(node, ctxt, src, flags) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virDomainDiskSourcePrivateDataParse(node, ctxt, src, flags, xmlopt) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
|
virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
|
Loading…
Reference in New Issue
Block a user