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

2017-09-29 Thread Michal Privoznik
On 09/29/2017 09:15 AM, Madhu Pavan wrote:
> This RFC is regarding https://bugzilla.redhat.com/show_bug.cgi?id=1497054
> 
> Let's say we have a network interface
>     
>   
>   
>   
>    function='0x0'/>
>     
> 
> and we are trying to detach the above interface with the following
> xml(vfpool.xml):
>     
>   
>   
>    function='0x0'/>
>     
> 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.

Well, since I had discussion about (hot) unplug API recently, I still
remember that it's documented that users are required to pass the full
device XML and not just a portion of it.

> 2. Improve error message by saying mac address is missing in the device
> xml.

But this is an actual bug. We can do better here.

Michal

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

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

2017-09-29 Thread Peter Krempa
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
> > >      
> > >    
> > >    
> > >    
> > >     > > function='0x0'/>
> > >      
> > > 
> > > and we are trying to detach the above interface with the following
> > > xml(vfpool.xml):
> > >      
> > >    
> > >    
> > >     > > function='0x0'/>
> > >      
> > > 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.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-09-29 Thread Madhu Pavan



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
     
   
   
   
   
     

and we are trying to detach the above interface with the following
xml(vfpool.xml):
     
   
   
   
     
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-09-29 Thread Peter Krempa
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
>     
>   
>   
>   
>    function='0x0'/>
>     
> 
> and we are trying to detach the above interface with the following
> xml(vfpool.xml):
>     
>   
>   
>    function='0x0'/>
>     
> 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.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-09-29 Thread Madhu Pavan

This RFC is regarding https://bugzilla.redhat.com/show_bug.cgi?id=1497054

Let's say we have a network interface
    
  
  
  
  function='0x0'/>

    

and we are trying to detach the above interface with the following 
xml(vfpool.xml):

    
  
  
  function='0x0'/>

    
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.

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