]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainDiskDefParseSource: parse source bits from driver element
authorPavel Hrdina <phrdina@redhat.com>
Thu, 27 May 2021 13:32:17 +0000 (15:32 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 1 Jun 2021 13:29:03 +0000 (15:29 +0200)
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: 0202467c4ba8663db2304b140af609f93a9b3091
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index f7920bce2c666803d43992e58fe4e1348cc24e5f..f424ed731fd6f1d48f7a0a1d85205b4afcaf0afc 100644 (file)
@@ -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;