|
|
c1c534 |
From fee89d5de8520422225dc06fa95cc2dad66d7ebe Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <fee89d5de8520422225dc06fa95cc2dad66d7ebe@dist-git>
|
|
|
c1c534 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
c1c534 |
Date: Mon, 13 Nov 2017 13:25:01 +0100
|
|
|
c1c534 |
Subject: [PATCH] conf: Properly parse <backingStore/>
|
|
|
c1c534 |
|
|
|
c1c534 |
The terminator would not be parsed properly since the XPath selector was
|
|
|
c1c534 |
looking for an populated element, and also the code did not bother
|
|
|
c1c534 |
assigning the terminating virStorageSourcePtr to the backingStore
|
|
|
c1c534 |
property of the parent.
|
|
|
c1c534 |
|
|
|
c1c534 |
Some tests would catch it if there wasn't bigger fallout from the change
|
|
|
c1c534 |
to backing store termination in a693fdba0111. Fix them properly now.
|
|
|
c1c534 |
|
|
|
c1c534 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509110
|
|
|
c1c534 |
(cherry picked from commit 19448a2561699807c075e071a45df292efd01f6b)
|
|
|
c1c534 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/conf/domain_conf.c | 18 ++++++++----------
|
|
|
c1c534 |
...base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 1 +
|
|
|
c1c534 |
.../qemuxml2xmlout-disk-active-commit.xml | 1 +
|
|
|
c1c534 |
.../qemuxml2xmlout-disk-backing-chains-active.xml | 3 +++
|
|
|
c1c534 |
.../qemuxml2xmlout-disk-mirror-active.xml | 4 ++++
|
|
|
c1c534 |
.../qemuxml2xmlout-disk-mirror-old.xml | 4 ++++
|
|
|
c1c534 |
.../qemuxml2xmlout-seclabel-static-labelskip.xml | 1 +
|
|
|
c1c534 |
7 files changed, 22 insertions(+), 10 deletions(-)
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
c1c534 |
index 27cfecffda..3b337d1a64 100644
|
|
|
c1c534 |
--- a/src/conf/domain_conf.c
|
|
|
c1c534 |
+++ b/src/conf/domain_conf.c
|
|
|
c1c534 |
@@ -8539,16 +8539,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
|
|
|
c1c534 |
char *idx = NULL;
|
|
|
c1c534 |
int ret = -1;
|
|
|
c1c534 |
|
|
|
c1c534 |
- if (!(ctxt->node = virXPathNode("./backingStore[*]", ctxt))) {
|
|
|
c1c534 |
- ret = 0;
|
|
|
c1c534 |
- goto cleanup;
|
|
|
c1c534 |
- }
|
|
|
c1c534 |
-
|
|
|
c1c534 |
- if (!(type = virXMLPropString(ctxt->node, "type"))) {
|
|
|
c1c534 |
- /* terminator does not have a type */
|
|
|
c1c534 |
- if (VIR_ALLOC(backingStore) < 0)
|
|
|
c1c534 |
- goto cleanup;
|
|
|
c1c534 |
-
|
|
|
c1c534 |
+ if (!(ctxt->node = virXPathNode("./backingStore", ctxt))) {
|
|
|
c1c534 |
ret = 0;
|
|
|
c1c534 |
goto cleanup;
|
|
|
c1c534 |
}
|
|
|
c1c534 |
@@ -8556,6 +8547,13 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
|
|
|
c1c534 |
if (VIR_ALLOC(backingStore) < 0)
|
|
|
c1c534 |
goto cleanup;
|
|
|
c1c534 |
|
|
|
c1c534 |
+ /* terminator does not have a type */
|
|
|
c1c534 |
+ if (!(type = virXMLPropString(ctxt->node, "type"))) {
|
|
|
c1c534 |
+ VIR_STEAL_PTR(src->backingStore, backingStore);
|
|
|
c1c534 |
+ ret = 0;
|
|
|
c1c534 |
+ goto cleanup;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+
|
|
|
c1c534 |
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
|
|
|
c1c534 |
(idx = virXMLPropString(ctxt->node, "index")) &&
|
|
|
c1c534 |
virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) {
|
|
|
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 9482b6794a..16caeb3542 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 |
@@ -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/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
|
|
|
c1c534 |
index 5766e4aea8..cc26af1096 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml
|
|
|
c1c534 |
@@ -20,6 +20,7 @@
|
|
|
c1c534 |
<backingStore type='block' index='1'>
|
|
|
c1c534 |
<format type='raw'/>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
</backingStore>
|
|
|
c1c534 |
<mirror type='block' job='active-commit'>
|
|
|
c1c534 |
<format type='raw'/>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
|
|
|
c1c534 |
index 828defcc25..d1fd2442c3 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml
|
|
|
c1c534 |
@@ -49,6 +49,7 @@
|
|
|
c1c534 |
<backingStore type='file' index='6'>
|
|
|
c1c534 |
<format type='raw'/>
|
|
|
c1c534 |
<source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
</backingStore>
|
|
|
c1c534 |
</backingStore>
|
|
|
c1c534 |
</backingStore>
|
|
|
c1c534 |
@@ -63,6 +64,7 @@
|
|
|
c1c534 |
<source protocol='gluster' name='Volume1/Image'>
|
|
|
c1c534 |
<host name='example.org' port='6000'/>
|
|
|
c1c534 |
</source>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<target dev='vdc' bus='virtio'/>
|
|
|
c1c534 |
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
@@ -79,6 +81,7 @@
|
|
|
c1c534 |
<backingStore type='file' index='1'>
|
|
|
c1c534 |
<format type='qcow2'/>
|
|
|
c1c534 |
<source file='/tmp/image.qcow'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
</backingStore>
|
|
|
c1c534 |
<target dev='vdd' bus='virtio'/>
|
|
|
c1c534 |
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
|
|
|
c1c534 |
index 252bde3389..c1e8a33ec1 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml
|
|
|
c1c534 |
@@ -16,6 +16,7 @@
|
|
|
c1c534 |
<emulator>/usr/bin/qemu-system-i686</emulator>
|
|
|
c1c534 |
<disk type='block' device='disk'>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<mirror type='block' job='copy' ready='yes'>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest1Copy'/>
|
|
|
c1c534 |
</mirror>
|
|
|
c1c534 |
@@ -24,12 +25,14 @@
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='block' device='cdrom'>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest2'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<target dev='hdc' bus='ide'/>
|
|
|
c1c534 |
<readonly/>
|
|
|
c1c534 |
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='file' device='disk'>
|
|
|
c1c534 |
<source file='/tmp/data.img'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
|
|
|
c1c534 |
<format type='qcow2'/>
|
|
|
c1c534 |
<source file='/tmp/copy.img'/>
|
|
|
c1c534 |
@@ -39,6 +42,7 @@
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='file' device='disk'>
|
|
|
c1c534 |
<source file='/tmp/logs.img'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
|
|
|
c1c534 |
<format type='qcow2'/>
|
|
|
c1c534 |
<source file='/tmp/logcopy.img'/>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
|
|
|
c1c534 |
index f4bd39a580..e390bc02f2 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
|
|
|
c1c534 |
@@ -16,6 +16,7 @@
|
|
|
c1c534 |
<emulator>/usr/bin/qemu-system-i686</emulator>
|
|
|
c1c534 |
<disk type='block' device='disk'>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' job='copy' ready='yes'>
|
|
|
c1c534 |
<source file='/dev/HostVG/QEMUGuest1Copy'/>
|
|
|
c1c534 |
</mirror>
|
|
|
c1c534 |
@@ -24,12 +25,14 @@
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='block' device='cdrom'>
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest2'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<target dev='hdc' bus='ide'/>
|
|
|
c1c534 |
<readonly/>
|
|
|
c1c534 |
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='file' device='disk'>
|
|
|
c1c534 |
<source file='/tmp/data.img'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
|
|
|
c1c534 |
<format type='qcow2'/>
|
|
|
c1c534 |
<source file='/tmp/copy.img'/>
|
|
|
c1c534 |
@@ -39,6 +42,7 @@
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
<disk type='file' device='disk'>
|
|
|
c1c534 |
<source file='/tmp/logs.img'/>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<target dev='vdb' bus='virtio'/>
|
|
|
c1c534 |
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
|
|
|
c1c534 |
index 91f573db7d..d37b950cbf 100644
|
|
|
c1c534 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
|
|
|
c1c534 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml
|
|
|
c1c534 |
@@ -18,6 +18,7 @@
|
|
|
c1c534 |
<source dev='/dev/HostVG/QEMUGuest1'>
|
|
|
c1c534 |
<seclabel model='selinux' labelskip='yes'/>
|
|
|
c1c534 |
</source>
|
|
|
c1c534 |
+ <backingStore/>
|
|
|
c1c534 |
<target dev='hda' bus='ide'/>
|
|
|
c1c534 |
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
c1c534 |
</disk>
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.15.0
|
|
|
c1c534 |
|