On Tue, Jun 12, 2018 at 06:06:02PM -0400, Laine Stump wrote:
On 06/12/2018 10:32 AM, John Ferlan wrote:
>
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
> peforming cleanup for both options as necessary.
IMO this is a step into the right direction - rather than tuning up the
device to be compatible with the live definition and hoping it will work
in the persistent definition is just naive.
But I feel like I should read the whole parser and post-parser to confidently
review this change. Also, even though it's 2018 we still generate the
MAC address for interfaces in the parser, so this would result in two
different interfaces being added into the definitions.
So what happens if someone requests only LIVE for the hotplug of one
device, and then both LIVE and CONFIG for another? Does the 2nd device
get a different address in the running guest than it has in the
persistent config?
For that case, we should be considering both domain definitions when
generating the addreess - at least for PCI addresses, we rely on calling
virDomainDefPostParse in qemuDomainAttachDeviceConfig (this in turn
calls the per-domain address assignment callback), which seems an
overkill if we only added one device. Maybe we need a way to assign the
address to just one device that would take both definitions into
consideration? That would also let us get rid of that
virDomainDefPostParse call.
Or we could focus our energy elsehwere.
Jano
>
> Signed-off-by: John Ferlan <jferlan(a)redhat.com>
> ---
> src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++----------------------------
> 1 file changed, 23 insertions(+), 29 deletions(-)
>