mirror of https://gitee.com/openkylin/libvirt.git
virDomainDiskDefParseSource: parse source bits from driver element
Before the mentioned commit we always parsed the whole disk definition
for qemuDomainBlockCopy API but we only used the @src part. Based on
that assumption the code was changed to parse only the disk <source>
element.
Unfortunately that is not correct as we need to parse some parts of
<driver> element as well.
Fixes: 0202467c4b
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
fe6ed00ef7
commit
9d225ea284
|
@ -15141,6 +15141,7 @@ virDomainDiskDefParseSource(const char *xmlStr,
|
|||
g_autoptr(xmlDoc) xml = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
g_autoptr(virStorageSource) src = NULL;
|
||||
xmlNodePtr driverNode;
|
||||
|
||||
if (!(xml = virXMLParseStringCtxtRoot(xmlStr, _("(disk_definition)"), "disk", &ctxt)))
|
||||
return NULL;
|
||||
|
@ -15148,6 +15149,11 @@ virDomainDiskDefParseSource(const char *xmlStr,
|
|||
if (!(src = virDomainDiskDefParseSourceXML(xmlopt, ctxt->node, ctxt, flags)))
|
||||
return NULL;
|
||||
|
||||
if ((driverNode = virXPathNode("./driver", ctxt))) {
|
||||
if (virDomainDiskDefDriverSourceParseXML(src, driverNode, ctxt) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virStorageSourceIsEmpty(src)) {
|
||||
virReportError(VIR_ERR_NO_SOURCE, NULL);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue