Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230613

Re: Error adding more than one PCI Passthrough device to vm with add-PassThroughDevice

$
0
0

For future reference I was able to add more than two passthrough PCI devices.In my case four GPUs. This is the code I came up with

 

$MyHostName = "<esx host name>"

$esx  = Get-VMHost -Name $MyHostName

 

 

$MyVMName = "<vn name>"

$MyVM  = Get-VM -Name $MyVMName

 

 

# Add GPUs to vm

$MyGPUs = $esx | get-passthroughdevice | Where{($_.State -eq "Active") -and ($_.Name -eq "NVIDIATesla M60")}

$MyGPUs | foreach{

    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.deviceChange = New-Object VMware.Vim.VirtualDeviceConfigSpec[] (1)

    $spec.deviceChange[0] = New-Object VMware.Vim.VirtualDeviceConfigSpec

    $spec.deviceChange[0].operation = 'add'

    $spec.deviceChange[0].device = New-Object VMware.Vim.VirtualPCIPassthrough

    $spec.deviceChange[0].device.key = "-100"

    $spec.deviceChange[0].device.backing = New-Object VMware.Vim.VirtualPCIPassthroughDeviceBackingInfo

    $spec.deviceChange[0].device.backing.deviceName = "NVIDIATesla M60"

     $spec.deviceChange[0].device.backing.id = $_.ExtensionData.pcidevice.id

     $spec.deviceChange[0].device.backing.deviceId = "13f2"

     $spec.deviceChange[0].device.backing.systemId = $_.extensiondata.systemid

     $spec.deviceChange[0].device.backing.vendorId = "4318"

     $vmobj = $myVM | Get-View

    $reconfig = $vmobj.ReconfigVM_Task($spec)

}


Viewing all articles
Browse latest Browse all 230613

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>