v2:
https://www.redhat.com/archives/libvir-list/2018-July/msg00361.html
Differences to v2:
Patch1: NEW - As a result of code review the suggestion was to utilize
the virDomainDefCompatibleDevice in order to make the check more
generic to include <disk>'s which were also afflicted with the
same problem that I was trying to solve with the former patch1
just for <hostdev>'s. However, this led me down into the abyss of
more changes since <disk>'s have multiple <address
type='drive'...>
target bus types (IDE and SCSI). That means we need to have a
mechanism to pass the target bus along so that a SCSI drive
address doesn't inadvertently match an IDE drive address. All
that is complicated by the way virDomainDefHasDeviceAddress
iterates through all the device lists. Whether there are more
similar devices I'm assuming will fall out of code review.
Patch2: This moves the virDomainDefHasDeviceAddress into the more
common config checking virDomainDefCompatibleDevice method,
but now needs to also account for the disk bus issue.
This theoretically could be combined with Patch1, but keeping
them separate I would hope makes for simpler code review. I
could also move code out of virDomainDefHasDeviceAddressIterator
into patch2, but if just felt better in patch1.
Patch3: No changes were made (amazingly so).
In the end quite a bit more complicated
John Ferlan (3):
conf: Add @target_bus to virDomainDefHasDeviceAddress
qemu: Check for existing address when cold attach device
qemu: Use the correct vm def on cold attach
src/conf/domain_conf.c | 54 +++++++++++++++++++++++++++++++++++---
src/conf/domain_conf.h | 3 ++-
src/qemu/qemu_driver.c | 59 ++++++++++++++++--------------------------
3 files changed, 75 insertions(+), 41 deletions(-)