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 :-)
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).