]> xenbits.xensource.com Git - libvirt.git/commit
qemu: avoid double reservation of PCI address for interface type='hostdev'
authorLaine Stump <laine@redhat.com>
Sat, 19 Oct 2019 05:58:07 +0000 (01:58 -0400)
committerLaine Stump <laine@redhat.com>
Thu, 7 Nov 2019 16:30:55 +0000 (11:30 -0500)
commit47a7b8a96b6343d4af18ef80330f805ef031fe9b
treeff0e2978f633f710fec6ac4e0a459698c6c26e89
parentcf915455e4404d8618ed9eadf3d5aad228d87f94
qemu: avoid double reservation of PCI address for interface type='hostdev'

Commit 01ca4010d86 (libvirt v5.1.0) moved address reservation for
hotplugged interface devices up to an earlier point in
qemuDomainAttachNetDevice(), because that function calls
qemuDomainSupportsNicdev() (in the case of
VIR_DOMAIN_NET_TYPE_VHOSTUSER), and qemuDomainSupportsNicdev() needs
to know the address type (for ARM machinetypes) and returns incorrect
results when the address type is "none".

This bugfix unfortunately caused a regression, because it also made PCI
address reservation happen before we noticed that the device was a
*hostdev* interface. Those interfaces are hotplugged by just calling
out to qemuDomainAttachHostdevDevice() - that function would then also
attempt to reserve the *same PCI address* that had just been reserved
in qemuDomainAttachNetDevice().

The solution is to move the bit of code that short-circuits out to
virDomainHostdevAttach() up *even earlier* so that no PCI address has
been allocated by the time it's called.

https://bugzilla.redhat.com/show_bug.cgi?id=1744523
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_hotplug.c