Blame SOURCES/libvirt-qemu-domain-Fix-backing-store-terminator-for-non-backing-local-files.patch

c1c534
From d3cf944874059fd81b68f8cc0beef6b8b69490bb Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <d3cf944874059fd81b68f8cc0beef6b8b69490bb@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Fri, 1 Dec 2017 15:57:03 +0100
c1c534
Subject: [PATCH] qemu: domain: Fix backing store terminator for non-backing
c1c534
 local files
c1c534
c1c534
Raw local files do not pass through the backing store detector and thus
c1c534
the code did not allocate the required backing store terminator for
c1c534
them. Previously the terminating element would be formatted into the XML
c1c534
since the default values used for the metadata allowed that. This is a
c1c534
regression since a693fdba0111ff which was not detected in the review.
c1c534
c1c534
This patch also reverts all the changes in the test files.
c1c534
c1c534
(cherry picked from commit adcc31bb89e47ef642cbcfcff372131db7cd8d8b)
c1c534
c1c534
 Conflicts:
c1c534
	src/qemu/qemu_domain.c - as with previous patch the return code
c1c534
        logic hat do be negated
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1509110
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_domain.c                                             | 7 +++++++
c1c534
 .../qemuhotplug-base-ccw-live+ccw-virtio.xml                       | 1 +
c1c534
 ...otplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 2 ++
c1c534
 .../qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml                | 1 +
c1c534
 ...hotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml | 1 +
c1c534
 .../qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml     | 1 +
c1c534
 ...qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 1 +
c1c534
 tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml   | 1 +
c1c534
 tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml    | 1 +
c1c534
 tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml | 1 +
c1c534
 .../qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml  | 1 +
c1c534
 11 files changed, 18 insertions(+)
c1c534
c1c534
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
c1c534
index 33cb3df949..9dd9db049b 100644
c1c534
--- a/src/qemu/qemu_domain.c
c1c534
+++ b/src/qemu/qemu_domain.c
c1c534
@@ -6372,6 +6372,13 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
c1c534
             goto cleanup;
c1c534
         }
c1c534
 
c1c534
+        /* terminate the chain for such images as the code below would do */
c1c534
+        if (!disk->src->backingStore &&
c1c534
+            VIR_ALLOC(disk->src->backingStore) < 0) {
c1c534
+            ret = -1;
c1c534
+            goto cleanup;
c1c534
+        }
c1c534
+
c1c534
         goto cleanup;
c1c534
     }
c1c534
 
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
c1c534
index 0fa8d036b9..cd03d0e09b 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='vde' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
c1c534
index 135427fff5..7be75f977b 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='hda' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
@@ -31,6 +32,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='hdb' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
c1c534
index e17c4e43b2..a83f1b5d73 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='hda' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
c1c534
index 326d312fa9..3e90207519 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='hda' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
c1c534
index 326d312fa9..3e90207519 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='hda' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
c1c534
index 16caeb3542..4c3ea3202b 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml
c1c534
@@ -33,6 +33,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='sdg' bus='scsi'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
c1c534
index a6dbf0b1bd..493a615fd3 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='sdf' bus='scsi'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
c1c534
index 6ccb88f140..3609819ea3 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-usb.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='sdq' bus='usb'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
c1c534
index b97c0b41e2..b88b220e33 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-virtio.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='vde' bus='virtio'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
c1c534
index 6422e1640d..c12d18f716 100644
c1c534
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
c1c534
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
c1c534
@@ -22,6 +22,7 @@
c1c534
     <disk type='file' device='disk'>
c1c534
       <driver name='qemu' type='raw' cache='none'/>
c1c534
       <source file='/dev/null'/>
c1c534
+      <backingStore/>
c1c534
       <target dev='sdf' bus='scsi'/>
c1c534
       <readonly/>
c1c534
       <shareable/>
c1c534
-- 
c1c534
2.15.1
c1c534