mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +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
|
static int
|
||||||
virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
@ -8638,7 +8614,8 @@ virDomainDiskSourceParse(xmlNodePtr node,
|
|||||||
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
!(src->auth = virStorageAuthDefParse(tmp, ctxt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDiskSourceEncryptionParse(node, &src->encryption, ctxt) < 0)
|
if ((tmp = virXPathNode("./encryption", ctxt)) &&
|
||||||
|
!(src->encryption = virStorageEncryptionParseNode(tmp, ctxt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0)
|
if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user