]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Use the correct vm def on cold attach
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Jun 2018 12:44:21 +0000 (08:44 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 25 Jul 2018 12:45:00 +0000 (08:45 -0400)
commit55ce65646348884656fd7bf3f109ebf8f7603494
treed68b2d694785c380ce2a5fc71959badf9204553b
parent7564daca8a71dfec4a22c55b6f11f266f7044e05
qemu: Use the correct vm def on cold attach

https://bugzilla.redhat.com/show_bug.cgi?id=1559867

When attaching a device to the domain we need to be sure
to use the correct domain definition (vm->def or vm->newDef)
when calling virDomainDeviceDefParse because the post parse
processing algorithms that may assign an address for the
device will use whatever domain definition was passed in.

Additionally, some devices (SCSI hostdev and SCSI disk) use
algorithms that rely on knowing what already exists of the
other type when generating the new device's address. Using
the wrong VM definition could result in duplicated addresses.

In the case of the bz, two hostdev's with no domain address
provided were added to the running domain's config only.
However, the parsing algorithm used the live domain in
order to figure out the host device address resulting in
the same address being used and a subsequent start failing
due to duplicate address.

Fix this by separating the checks/code into CONFIG and LIVE
processing using the correct definition for each block and
performing cleanup for both options as necessary.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c