mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
conf: Replace virDomainDiskSourceEncryptionParse 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
1e6e34b144
commit
6a59d6c103
@ -8540,30 +8540,6 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDiskSourceEncryptionParse(xmlNodePtr node,
|
||||
virStorageEncryptionPtr *encryptionsrc,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
xmlNodePtr child;
|
||||
virStorageEncryptionPtr encryption = NULL;
|
||||
|
||||
for (child = node->children; child; child = child->next) {
|
||||
if (child->type == XML_ELEMENT_NODE &&
|
||||
virXMLNodeNameEqual(child, "encryption")) {
|
||||
|
||||
if (!(encryption = virStorageEncryptionParseNode(child, ctxt)))
|
||||
return -1;
|
||||
|
||||
*encryptionsrc = encryption;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
||||
virStorageSourcePtr src,
|
||||
@ -8638,7 +8614,8 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
||||
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDiskSourceEncryptionParse(node, &src->encryption, ctxt) < 0)
|
||||
if ((tmp = virXPathNode("./encryption", ctxt)) &&
|
||||
!(src->encryption = virStorageEncryptionParseNode(tmp, ctxt)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user