[libvirt] how to know if PCI device has SR-IOV PF capability

Daniel P. Berrange berrange at redhat.com
Mon Nov 23 15:40:43 UTC 2015


On Mon, Nov 23, 2015 at 10:34:43AM -0500, Laine Stump wrote:
> On 11/23/2015 05:05 AM, Daniel P. Berrange wrote:
> >On Sun, Nov 22, 2015 at 11:04:28AM +0000, Moshe Levi wrote:
> >>Hi,
> >>
> >>I was looking on the output of virsh nodedev-dumpxml on a PCI to see if it has SR-IOV PF  capability.
> >>It seem that if the virtual functions are enables the xml look like [1] but if the PCI has no VFs enabled the
> >>output is like in [2].
> >>As you can see for PCI which has  no VFs the <capability type='virt_functions'>  tag doen't exist.
> >>Is this by design?
> >>I would except that <capability type='virt_functions'/> tag with empty elements will also be include in that case.
> >That is an bug. The capability should be reported regardless of whether
> >any are VFs currently enabled, so we should fix this.
> 
> Prior to libvirt 1.0.4, "<capability type='virt_functions'>" was there for
> every PCI device regardless of whether or not it had the ability to have
> virtual functions. It looks like commit 9a3ff01d changed it to only emit
> that element when there was at least one VF. So it used to be wrong, and now
> it is wrong in a different way :-)

Awesome.

> If we're going to switch to emiting virt_functions whenever a device has the
> potential to provide VFs, we may as well make it worthwhile and also emit
> the maximum possible VFs for the device, maybe simply:
> 
>     <capability type='virt_functions' maxCount='7'>
> 
> (the current count is implicit in the number of entries in the list that
> follows. I don't have an opinion on whether it is better to also include
> explicitly with, e.g. "count='7'", or just leave it implicit).

Is there any way for us to actually discover the max count ? If so, then
it seems nice to include it.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list