mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
conf: metadata: ignore empty metadata element
Do not copy the <metadata> node to domain/network definition if its empty. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
633c55dbd6
commit
0b69d47774
@ -19855,8 +19855,10 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt,
|
||||
return NULL;
|
||||
|
||||
/* Extract custom metadata */
|
||||
if ((node = virXPathNode("./metadata[1]", ctxt)) != NULL)
|
||||
if ((node = virXPathNode("./metadata[1]", ctxt)) != NULL &&
|
||||
xmlFirstElementChild(node)) {
|
||||
def->metadata = xmlCopyNode(node, 1);
|
||||
}
|
||||
|
||||
/* we have to make a copy of all of the callback pointers here since
|
||||
* we won't have the virCaps structure available during free
|
||||
|
@ -1898,7 +1898,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
/* Extract custom metadata */
|
||||
if ((metadataNode = virXPathNode("./metadata[1]", ctxt)) != NULL) {
|
||||
if ((metadataNode = virXPathNode("./metadata[1]", ctxt)) != NULL &&
|
||||
xmlFirstElementChild(metadataNode)) {
|
||||
def->metadata = xmlCopyNode(metadataNode, 1);
|
||||
virXMLNodeSanitizeNamespaces(def->metadata);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user