VMware Cloud Community
frefal
Enthusiast
Enthusiast
Jump to solution

Pcipassthru

Hi!

Could anyone be kind enough to provide me an example how to add a pci passthru device to a virtual machine?

Reply
0 Kudos
1 Solution

Accepted Solutions
frefal
Enthusiast
Enthusiast
Jump to solution

Hi,

I didnt touch this since then basically. With Powercli I was not able, however today I got it working with Orchestrator:

var spec = new VcVirtualMachineConfigSpec();
var myDeviceChange = new Array();
var pci = new VcVirtualPCIPassthrough();
var pciBacking = new VcVirtualPCIPassthroughDeviceBackingInfo();
var configSpec = new VcVirtualDeviceConfigSpec();

pciBacking.deviceId = "FF2";
pciBacking.systemId = "504f0c5f-440d-f08a-3872-d4ae529e9a2c";
pciBacking.deviceName = "GK107GL [GRID K1]";
pciBacking.vendorId = "10DE";
pciBacking.id = "46:00.0";

pci.backing = pciBacking;

configSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
configSpec.device = pci;
myDeviceChange.push(configSpec);
spec.deviceChange = myDeviceChange;

vm.reconfigVM_Task(spec);

You can obtain pcibacking info via

var ptArray = cluster.EnvironmentBrowser.queryConfigTarget(host).pciPassthrough;

View solution in original post

Reply
0 Kudos
8 Replies
tschoergez
Leadership
Leadership
Jump to solution

Reply
0 Kudos
frefal
Enthusiast
Enthusiast
Jump to solution

I have already tried with onyx, but I got no output when adding a pci device. But just like in the example, I tried changing settings on the video card and it gave me output.

Reply
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

hm, ok.

Doing a quick search in the API reference I found the HostPciPassthroughSystem that allows to configure phys. cards to enable for passthrough:

https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.PciPassthruSyst...

From a VM configuration perspective, I assume it would be part of the deviceSpec when doing a reconfigVM_Task. However, the VirtualPCIPassthrough device type shows no attributes in the documentation.

So either this is not at all documented, or there is just no API for that 😕

My recommendation: Configure it manually for a VM, then try to "read" the device configuration of that VM, to figure out the structure of a VirtualPCIPassthrough device.

Do you know if it's possible using PowerCLI?

Cheers,

Joerg

Reply
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

just out of curiosity I googled for powercli:

Sysadmin Stories: VMware DirectPath I/O - adding passthrough PCI devices to VM

Add-PassthroughDevice - vSphere PowerCLI Cmdlets Reference

So it seems there is an API (or the PowerCLI cmdlets do use some internal only thing)....

Reply
0 Kudos
frefal
Enthusiast
Enthusiast
Jump to solution

Thanks, gonna take a look at the vm config. That might provide some hints.

It is possible to add with powercli, Add-PassthroughDevice

Reply
0 Kudos
frefal
Enthusiast
Enthusiast
Jump to solution

There is one problem with the powercli, which i was hoping Orchestrator could provide a solution for. When i get the pci devices from the host it just gets the "container".

 

Get-PassthroughDevice -Type Pci -VMHost host -Name "NVIDIAGRID K2"

lists:

Key        Name                           VendorName                     Type                                   

---        ----                           ----------                     ----                                   

           NVIDIAGRID K2                  NVIDIA Corporation             Pci                                   

This K2 card contains 2 graphic cores located on different buses. If i add this K2 PCI device to a VM, it will just add the core on the lowest bus number, running the command a second time add the first core yet again. So as far I have not figured out how to select which core to assign. This is not a discussion for this forum, though. But if anyone else have any idea how to add a passthru device with Orchestrator then this information could perhaps come handy!

$k2 = Get-PassthroughDevice -Type Pci -VMHost host -Name "NVIDIAGRID K2"

$k2.Bus

returns 6

6 = first core 7 = second core.

Reply
0 Kudos
Klean
Contributor
Contributor
Jump to solution

Have you found a solution that will allow powercli or orchestrator to see and assign all of the cores for your grid card? I'm running into the same problem with my Nvidia Grid K1 cards.

Reply
0 Kudos
frefal
Enthusiast
Enthusiast
Jump to solution

Hi,

I didnt touch this since then basically. With Powercli I was not able, however today I got it working with Orchestrator:

var spec = new VcVirtualMachineConfigSpec();
var myDeviceChange = new Array();
var pci = new VcVirtualPCIPassthrough();
var pciBacking = new VcVirtualPCIPassthroughDeviceBackingInfo();
var configSpec = new VcVirtualDeviceConfigSpec();

pciBacking.deviceId = "FF2";
pciBacking.systemId = "504f0c5f-440d-f08a-3872-d4ae529e9a2c";
pciBacking.deviceName = "GK107GL [GRID K1]";
pciBacking.vendorId = "10DE";
pciBacking.id = "46:00.0";

pci.backing = pciBacking;

configSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
configSpec.device = pci;
myDeviceChange.push(configSpec);
spec.deviceChange = myDeviceChange;

vm.reconfigVM_Task(spec);

You can obtain pcibacking info via

var ptArray = cluster.EnvironmentBrowser.queryConfigTarget(host).pciPassthrough;

Reply
0 Kudos