提交 19448a25 编写于 作者: P Peter Krempa

conf: Properly parse <backingStore/>

The terminator would not be parsed properly since the XPath selector was
looking for an populated element, and also the code did not bother
assigning the terminating virStorageSourcePtr to the backingStore
property of the parent.

Some tests would catch it if there wasn't bigger fallout from the change
to backing store termination in a693fdba. Fix them properly now.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509110
上级 676768ed
...@@ -8545,23 +8545,21 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, ...@@ -8545,23 +8545,21 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
char *idx = NULL; char *idx = NULL;
int ret = -1; int ret = -1;
if (!(ctxt->node = virXPathNode("./backingStore[*]", ctxt))) { if (!(ctxt->node = virXPathNode("./backingStore", ctxt))) {
ret = 0; ret = 0;
goto cleanup; goto cleanup;
} }
if (!(type = virXMLPropString(ctxt->node, "type"))) { if (VIR_ALLOC(backingStore) < 0)
/* terminator does not have a type */ goto cleanup;
if (VIR_ALLOC(backingStore) < 0)
goto cleanup;
/* terminator does not have a type */
if (!(type = virXMLPropString(ctxt->node, "type"))) {
VIR_STEAL_PTR(src->backingStore, backingStore);
ret = 0; ret = 0;
goto cleanup; goto cleanup;
} }
if (VIR_ALLOC(backingStore) < 0)
goto cleanup;
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
(idx = virXMLPropString(ctxt->node, "index")) && (idx = virXMLPropString(ctxt->node, "index")) &&
virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) { virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<disk type='file' device='disk'> <disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/> <driver name='qemu' type='raw' cache='none'/>
<source file='/dev/null'/> <source file='/dev/null'/>
<backingStore/>
<target dev='sdf' bus='scsi'/> <target dev='sdf' bus='scsi'/>
<readonly/> <readonly/>
<shareable/> <shareable/>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<backingStore type='block' index='1'> <backingStore type='block' index='1'>
<format type='raw'/> <format type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore/>
</backingStore> </backingStore>
<mirror type='block' job='active-commit'> <mirror type='block' job='active-commit'>
<format type='raw'/> <format type='raw'/>
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<backingStore type='file' index='6'> <backingStore type='file' index='6'>
<format type='raw'/> <format type='raw'/>
<source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/> <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
<backingStore/>
</backingStore> </backingStore>
</backingStore> </backingStore>
</backingStore> </backingStore>
...@@ -63,6 +64,7 @@ ...@@ -63,6 +64,7 @@
<source protocol='gluster' name='Volume1/Image'> <source protocol='gluster' name='Volume1/Image'>
<host name='example.org' port='6000'/> <host name='example.org' port='6000'/>
</source> </source>
<backingStore/>
<target dev='vdc' bus='virtio'/> <target dev='vdc' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk> </disk>
...@@ -79,6 +81,7 @@ ...@@ -79,6 +81,7 @@
<backingStore type='file' index='1'> <backingStore type='file' index='1'>
<format type='qcow2'/> <format type='qcow2'/>
<source file='/tmp/image.qcow'/> <source file='/tmp/image.qcow'/>
<backingStore/>
</backingStore> </backingStore>
<target dev='vdd' bus='virtio'/> <target dev='vdd' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<emulator>/usr/bin/qemu-system-i686</emulator> <emulator>/usr/bin/qemu-system-i686</emulator>
<disk type='block' device='disk'> <disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore/>
<mirror type='block' job='copy' ready='yes'> <mirror type='block' job='copy' ready='yes'>
<source dev='/dev/HostVG/QEMUGuest1Copy'/> <source dev='/dev/HostVG/QEMUGuest1Copy'/>
</mirror> </mirror>
...@@ -24,12 +25,14 @@ ...@@ -24,12 +25,14 @@
</disk> </disk>
<disk type='block' device='cdrom'> <disk type='block' device='cdrom'>
<source dev='/dev/HostVG/QEMUGuest2'/> <source dev='/dev/HostVG/QEMUGuest2'/>
<backingStore/>
<target dev='hdc' bus='ide'/> <target dev='hdc' bus='ide'/>
<readonly/> <readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk> </disk>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<source file='/tmp/data.img'/> <source file='/tmp/data.img'/>
<backingStore/>
<mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'> <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
<format type='qcow2'/> <format type='qcow2'/>
<source file='/tmp/copy.img'/> <source file='/tmp/copy.img'/>
...@@ -39,6 +42,7 @@ ...@@ -39,6 +42,7 @@
</disk> </disk>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<source file='/tmp/logs.img'/> <source file='/tmp/logs.img'/>
<backingStore/>
<mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'> <mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
<format type='qcow2'/> <format type='qcow2'/>
<source file='/tmp/logcopy.img'/> <source file='/tmp/logcopy.img'/>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<emulator>/usr/bin/qemu-system-i686</emulator> <emulator>/usr/bin/qemu-system-i686</emulator>
<disk type='block' device='disk'> <disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore/>
<mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' job='copy' ready='yes'> <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' job='copy' ready='yes'>
<source file='/dev/HostVG/QEMUGuest1Copy'/> <source file='/dev/HostVG/QEMUGuest1Copy'/>
</mirror> </mirror>
...@@ -24,12 +25,14 @@ ...@@ -24,12 +25,14 @@
</disk> </disk>
<disk type='block' device='cdrom'> <disk type='block' device='cdrom'>
<source dev='/dev/HostVG/QEMUGuest2'/> <source dev='/dev/HostVG/QEMUGuest2'/>
<backingStore/>
<target dev='hdc' bus='ide'/> <target dev='hdc' bus='ide'/>
<readonly/> <readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk> </disk>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<source file='/tmp/data.img'/> <source file='/tmp/data.img'/>
<backingStore/>
<mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'> <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
<format type='qcow2'/> <format type='qcow2'/>
<source file='/tmp/copy.img'/> <source file='/tmp/copy.img'/>
...@@ -39,6 +42,7 @@ ...@@ -39,6 +42,7 @@
</disk> </disk>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<source file='/tmp/logs.img'/> <source file='/tmp/logs.img'/>
<backingStore/>
<target dev='vdb' bus='virtio'/> <target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk> </disk>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<source dev='/dev/HostVG/QEMUGuest1'> <source dev='/dev/HostVG/QEMUGuest1'>
<seclabel model='selinux' labelskip='yes'/> <seclabel model='selinux' labelskip='yes'/>
</source> </source>
<backingStore/>
<target dev='hda' bus='ide'/> <target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk> </disk>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册