mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
conf: Don't require 'def' in virDomainDiskDefParse
In some use cases (mostly in tests) it is not required to check the seclabel definition validity. Add possibility to call virDomainDiskDefParse without the domain definition. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
295b128e09
commit
1cb7f41568
@ -15873,6 +15873,8 @@ virDomainDiskDefParse(const char *xmlStr,
|
||||
xmlDocPtr xml;
|
||||
xmlXPathContextPtr ctxt = NULL;
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virSecurityLabelDefPtr *seclabels = NULL;
|
||||
size_t nseclabels = 0;
|
||||
|
||||
if (!(xml = virXMLParseStringCtxt(xmlStr, _("(disk_definition)"), &ctxt)))
|
||||
goto cleanup;
|
||||
@ -15884,10 +15886,13 @@ virDomainDiskDefParse(const char *xmlStr,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (def) {
|
||||
seclabels = def->seclabels;
|
||||
nseclabels = def->nseclabels;
|
||||
}
|
||||
|
||||
disk = virDomainDiskDefParseXML(xmlopt, ctxt->node, ctxt,
|
||||
NULL, def->seclabels,
|
||||
def->nseclabels,
|
||||
flags);
|
||||
NULL, seclabels, nseclabels, flags);
|
||||
|
||||
cleanup:
|
||||
xmlFreeDoc(xml);
|
||||
|
Loading…
Reference in New Issue
Block a user