Re: RFC: Detaching interface from guest fails with improper error message if no mac given in xml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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?

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux