提交 0d210c47 编写于 作者: L Laine Stump

conf: support reporting maxCount attribute for virtual_functions cap

Report the maximum possible number of VFs for an SRIOV PF, like this:

   <capability type='virtual_functions' maxCount='7'>
      ...
   </capability>

I've just discovered that the virtual_functions and physical_functions
capabilities are not supported in the virNodeDeviceParse functions,
only in virNodeDeviceFormat (I suppose because they are only reported,
not set from XML). This should probably be remedied, but is less
immediately useful than the current patch.
上级 0076d8db
......@@ -108,7 +108,16 @@
the type is <code>virtual_functions</code>, then this
device is an SRIOV PF, and the capability element will
have a list of <code>address</code> subelements, one
for each VF on this PF.
for each VF on this PF. If the host system supports
reporting it (via the "sriov_maxvfs" file in the
device's sysfs directory) the capability element will
also have an attribute named <code>maxCount</code>
which is the maximum number of SRIOV VFs supported by
this device, which could be higher than the number of
VFs that are curently active <span class="since">since
1.3.0</span>; in this case, even if there are
currently no active VFs the virtual_functions
capabililty will still be shown.
</dd>
<dt><code>numa</code></dt>
<dd>
......
......@@ -361,7 +361,14 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
virBufferAddLit(&buf, "</capability>\n");
}
if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) {
virBufferAddLit(&buf, "<capability type='virt_functions'>\n");
virBufferAddLit(&buf, "<capability type='virt_functions'");
if (data->pci_dev.max_virtual_functions)
virBufferAsprintf(&buf, " maxCount='%u'",
data->pci_dev.max_virtual_functions);
if (data->pci_dev.num_virtual_functions == 0) {
virBufferAddLit(&buf, "/>\n");
} else {
virBufferAddLit(&buf, ">\n");
virBufferAdjustIndent(&buf, 2);
for (i = 0; i < data->pci_dev.num_virtual_functions; i++) {
virBufferAsprintf(&buf,
......@@ -375,6 +382,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</capability>\n");
}
}
if (data->pci_dev.nIommuGroupDevices) {
virBufferAsprintf(&buf, "<iommuGroup number='%d'>\n",
data->pci_dev.iommuGroupNumber);
......
......@@ -112,6 +112,7 @@ typedef struct _virNodeDevCapData {
virPCIDeviceAddressPtr physical_function;
virPCIDeviceAddressPtr *virtual_functions;
size_t num_virtual_functions;
unsigned int max_virtual_functions;
unsigned int flags;
virPCIDeviceAddressPtr *iommuGroupDevices;
size_t nIommuGroupDevices;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册