On Fri, Sep 29, 2017 at 14:18:52 +0530, Madhu Pavan wrote: > > > On 09/29/2017 01:27 PM, Peter Krempa wrote: > > On Fri, Sep 29, 2017 at 12:45:30 +0530, Madhu Pavan wrote: > > > This RFC is regarding https://bugzilla.redhat.com/show_bug.cgi?id=1497054 > > > > > > Let's say we have a network interface > > > <interface type='network'> > > > <mac address='52:54:00:fe:10:57'/> > > > <source network='vfnetwork'/> > > > <model type='virtio'/> > > > <address type='pci' domain='0x0000' bus='0x01' slot='0x01' > > > function='0x0'/> > > > </interface> > > > > > > and we are trying to detach the above interface with the following > > > xml(vfpool.xml): > > > <interface type='network'> > > > <source network='vfnetwork'/> > > > <model type='virtio'/> > > > <address type='pci' domain='0x0000' bus='0x01' slot='0x01' > > > function='0x0'/> > > > </interface> > > > Detaching the interface returns error: > > > # virsh detach-device vffuest vfpool.xml > > > error: Failed to detach device from vfpool.xml > > > error: operation failed: no device matching mac address 52:54:00:54:f6:61 > > > found > > > > > > Here the mac address is auto-generated as we haven't given in the > > > vfpool.xml. > > > And virDomainNetFindIdx will try to match the auto-generated mac address > > > with > > > the domain xml. It fails as there will be no match and the error message > > > says > > > "no device matching mac address 52:54:00:54:f6:61 found". > > > > > > Here in this scenario I see two possible improvements. > > > 1. As virDomainNetFindIdx search according to mac address and guest side > > > PCI address (if specified), we can search for PCI address and avoid > > > mac address search if mac is not given in the xml. As the PCI address > > > is unique we don't compromise in performance. > > > 2. Improve error message by saying mac address is missing in the device xml. > > I think the problem is that the mac address is always generated in the > > device XML parser. Auto assignment of the mac address is necessary when > > the device is added to the VM. When removing, generating the mac address > > is bogus. > > > > I think we need to make sure that no unique ids are added to the parser > > at least in the cases when the XML is parsed for the unplug code path. > I have a patch ready to search according to PCI address in the absence > of mac address. I can make changes to it so that mac address is not > auto-generated. Is this good to proceed in this direction? That patch probably will be necessary as well. The lookup of network devices tries to compare the mac address as the first thing. Since we've never had the option for the mac address to be missing you'll need to fix it. The problem is that you need to not generate the address since you won't be able to tell in the qemu code whether the address was present or not. Also there's the problem that the mac address is always present in the definition object so you are looking for a substantial refactoring job to make sure that it can be missing in some cases. Or at least remember that it was autogenerated.
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list