[libvirt] [PATCH 0/6] auto-assign addresses when <address type='pci'/> is specified
Laine Stump
laine at laine.org
Fri May 20 17:50:45 UTC 2016
On 05/20/2016 02:32 AM, Ján Tomko wrote:
> On Thu, May 19, 2016 at 05:14:33PM -0400, Laine Stump wrote:
>> On 05/19/2016 01:23 PM, Ján Tomko wrote:
>>> Yes, qemu_hotplug.c has a few of those places using == DEVICE_ADDRESS_TYPE_PCI
>>> untouched by this series.
>> Since they happen after parse is finished, it should be safe.
>>
>> And anyway, looking at those uses, I think what most of them are doing
>> (calling virDomainPCIAddressEnsureAddr()) is 100% unnecessary, since
>> it's now already done when addresses are assigned in
>> qemuDomainDefAssignAddresses(), which has already been called.
> Actually, virDomainPCIAddressEnsureAddr is the place where the address
> gets assigned.
Exactly. But I was looking only at the _CONFIG version of hotplug, and
saw that the PCI address had already been assigned by the time we called
EnsureAddr, so it was superfluous. I didn't catch the bit that you point
out below - in the case of live-only that assignment isn't done.
> But only when address == NONE or PCI, which is OK because
> virDomainPCIAddressEnsureAddr calls PCIAddressIsPresent to decide
> whether it needs to allocate a new one.
>
> qemuDomainDefAssignAddresses is only called after parsing the whole
> domain, not just one device.
Cole pushed a patch yesterday to cause it to be called during
attach-device as well, but only in the case of _CONFIG, so your point
still stands. I guess the patch to remove the other EnsureAddr stuff
needs to be combined with moving that AssignAddresses call to a point
that is common for live and config (which makes sense - they really do
both need the same address)
>
>> (Back in
>> Jan 2010 when the calls to qemuDomainPCIAddressEnsureAddr() were added
>> (commit d8acc4), this was not the case - they were needed in order for
>> the new devices to get an address assigned, but a lot has changed since
>> then - even before Cole put in the postparse callback address assignment
>> stuff and called it when attaching a device, we had already been
>> assigning addresses during the higher level qemuDomainAttachDeviceConfig
>> for a long time (since commit f5dd58a in June 2012;
> qemuDomainAttachDeviceConfig is for changing the persistent definition.
> Hotplug in qemuDomainAttachDeviceLive does not call any other address
> assignment function.
Yeah, I missed that in my haste.
More information about the libvir-list
mailing list