Only selected fields from the disk source were copied when cold updating
source in a CDROM drive. When such drive was backed by a network file
this resulted into corruption of the definition:
<disk type='network' device='cdrom'>
<driver name='qemu' type='raw' cache='none'/>
<source protocol='gluster' name='gluster-vol1(null)'>
<host name='localhost'/>
</source>
<target dev='vdc' bus='virtio'/>
<readonly/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x0a' function='0x0'/>
</disk>
Update the whole source instead of cherry-picking elements.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1166024
---
src/qemu/qemu_driver.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b3263ac..0062f36 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8010,19 +8010,11 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
* Update 'orig'
* We allow updating src/type//driverType/cachemode/
*/
- VIR_FREE(orig->src->path);
- orig->src->path = disk->src->path;
- orig->src->type = disk->src->type;
orig->cachemode = disk->cachemode;
- if (disk->src->driverName) {
- VIR_FREE(orig->src->driverName);
- orig->src->driverName = disk->src->driverName;
- disk->src->driverName = NULL;
- }
- if (disk->src->format)
- orig->src->format = disk->src->format;
- disk->src->path = NULL;
- orig->startupPolicy = disk->startupPolicy;
+
+ virStorageSourceFree(orig->src);
+ orig->src = disk->src;
+ disk->src = NULL;
break;
case VIR_DOMAIN_DEVICE_GRAPHICS:
--
2.2.2