On Mon, Nov 23, 2015 at 04:50:14PM -0500, Laine Stump wrote: > A PCI device may have the capability to setup virtual functions (VFs) > but have them currently all disabled. Prior to this patch, if that was > the case the the node device XML for the device wouldn't report any s/the the/the/ > virtual_functions capability. > > With this patch, if a file called "sriov_totalvfs" is found in the > device's sysfs directory, its contents will be interpreted as a > decimal number, and that value will be reported as "maxCount" in a > capability element of the device's XML, e.g.: > > <capability type='virtual_functions' maxCount='7'/> > > This will be reported regardless of whether or not any VFs are > currently enabled for the device. > > NB: sriov_numvfs (the number of VFs currently active) is also > available in sysfs, but that value is implied by the number of items > in the list that is inside the capability element, so there is no > reason to explicitly provide it as an attribute. > > sriov_totalvfs and sriov_numvfs are available in kernels at least as far > back as the 2.6.32 that is in RHEL6.7, but in the case that they > simply aren't there, libvirt will behave as it did prior to this patch > - no maxCount will be displayed, and the virtual_functions capability > will be absent from the device's XML when 0 VFs are enabled. > --- > src/network/bridge_driver.c | 5 +++-- > src/node_device/node_device_linux_sysfs.c | 7 +++++-- > src/util/virnetdev.c | 9 ++++++--- > src/util/virnetdev.h | 5 +++-- > src/util/virpci.c | 30 ++++++++++++++++++++++++++---- > src/util/virpci.h | 5 +++-- > 6 files changed, 46 insertions(+), 15 deletions(-) > ACK Pavel -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list