[libvirt-users] [libvirt] Why virsh domxml-to-native qemu-argv changes PCI slot number

Andrea Bolognani abologna at redhat.com
Thu Apr 18 15:39:59 UTC 2019


On Thu, 2019-04-18 at 15:29 +0100, Daniel P. Berrangé wrote:
> On Thu, Apr 18, 2019 at 04:23:05PM +0200, Andrea Bolognani wrote:
> > qemuDomainAssignAddresses() is supposed to make sure that any address
> > configured explicitly by the user (or previously by libvirt) is
> > preserved, and it's doing that correctly when it's called from inside
> > qemuDomainDefAssignAddresses(); however, for some reason, by the time
> > we call it again in qemuProcessPrepareDomain() the PCI address for
> > the network interface is no longer set, and so a fresh one gets
> > assigned instead.
> > 
> > I'll investigate further and get back to you.
> 
> It is a bug in qemuConnectDomainXMLToNative. You'll see we replace
> the original type=bridge NIC with a type=ethernet, except we fail
> to copy the address info & probably other properties too.

Yeah, I figured that out after digging a bit more :)

I'm not quite sure how to fix it properly, though. Adding yet more
properties to the list of those we record before calling
virDomainNetDefClear() and restore afterwards would be a stop-gap
measure at best; limiting ourselves to merely changing net->type,
on the other hand, though it seems to work from a quick test, will
likely lead to hitting other corner cases.

Formatting the XML, replacing the type attribute and parsing it
back perhaps? Other, hopefully better, ideas?

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvirt-users mailing list