mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Replace virDomainDiskSourceAuthParse by an XPath query
Remove the rather bulky function in favor of an XPath query. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
183f96314d
commit
e7c44b3f7c
@ -8540,30 +8540,6 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
virDomainDiskSourceAuthParse(xmlNodePtr node,
|
|
||||||
virStorageAuthDefPtr *authdefsrc,
|
|
||||||
xmlXPathContextPtr ctxt)
|
|
||||||
{
|
|
||||||
xmlNodePtr child;
|
|
||||||
virStorageAuthDefPtr authdef;
|
|
||||||
|
|
||||||
for (child = node->children; child; child = child->next) {
|
|
||||||
if (child->type == XML_ELEMENT_NODE &&
|
|
||||||
virXMLNodeNameEqual(child, "auth")) {
|
|
||||||
|
|
||||||
if (!(authdef = virStorageAuthDefParse(child, ctxt)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
*authdefsrc = authdef;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainDiskSourceEncryptionParse(xmlNodePtr node,
|
virDomainDiskSourceEncryptionParse(xmlNodePtr node,
|
||||||
virStorageEncryptionPtr *encryptionsrc)
|
virStorageEncryptionPtr *encryptionsrc)
|
||||||
@ -8627,6 +8603,7 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
xmlNodePtr saveNode = ctxt->node;
|
xmlNodePtr saveNode = ctxt->node;
|
||||||
|
xmlNodePtr tmp;
|
||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
@ -8656,7 +8633,8 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDiskSourceAuthParse(node, &src->auth, ctxt) < 0)
|
if ((tmp = virXPathNode("./auth", ctxt)) &&
|
||||||
|
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDiskSourceEncryptionParse(node, &src->encryption) < 0)
|
if (virDomainDiskSourceEncryptionParse(node, &src->encryption) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user