qemu: driver: Fix cold-update of removable storage devices

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
This commit is contained in:
Peter Krempa 2015-03-12 17:12:12 +01:00
parent e7974b4f80
commit d0dc6c0369

View File

@ -8166,19 +8166,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: