[libvirt] [PATCH] expose SR IOV physical/virtual function relationships
Dave Allan
dallan at redhat.com
Tue Dec 1 17:22:05 UTC 2009
Cole Robinson wrote:
> On 12/01/2009 10:33 AM, Dave Allan wrote:
>> Attached is a patch that exposes the relationships between physical and
>> virtual functions on SR IOV capable devices.
>>
>> Dave
>>
>
>> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
>> index 6003ab1..4b5d17c 100644
>> --- a/src/conf/node_device_conf.c
>> +++ b/src/conf/node_device_conf.c
>> @@ -246,6 +246,7 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
>> {
>> virBuffer buf = VIR_BUFFER_INITIALIZER;
>> virNodeDevCapsDefPtr caps;
>> + unsigned int i = 0;
>> char *tmp;
>>
>> virBufferAddLit(&buf, "<device>\n");
>> @@ -318,6 +319,16 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
>> data->pci_dev.vendor_name);
>> else
>> virBufferAddLit(&buf, " />\n");
>> + if (data->pci_dev.physical_function) {
>> + virBufferEscapeString(&buf, " <physical_function>%s</physical_function>\n",
>> + data->pci_dev.physical_function);
>> + }
>> + if (data->pci_dev.num_virtual_functions > 0) {
>> + for (i = 0 ; i < data->pci_dev.num_virtual_functions ; i++) {
>> + virBufferEscapeString(&buf, " <virtual_function>%s</virtual_function>\n",
>> + data->pci_dev.virtual_functions[i]);
>> + }
>> + }
>> break;
>> case VIR_NODE_DEV_CAP_USB_DEV:
>> virBufferVSprintf(&buf, " <bus>%d</bus>\n", data->usb_dev.bus);
>
> It would be nice to drop a test file in tests/nodedevschemadata, and
> update tests/nodedevxml2xmltest.c to make sure the roundtrip define +
> dumpxml is working.
Thanks, Cole--I'll do that.
Dave
More information about the libvir-list
mailing list