Проброс видеокарты хоста в машину HYPER-V
Dec. 12th, 2018 02:58 pmИногда надо передать в виртуальную машину ресурсы физической видеокарты сервера.
После многих тестов пришел к решению, что оптимально - смонтировать физическую видеокарту в гостевую машину, особенно, если там работает много народа, кому требуется обработка изображения, например демонстрация видео и карт клиентам.
Вот оно решение, которое меня устроило.
На сервере RDS работает до 25 человек - продавцов путешествий. Все одновременно могут показывать клиентам всякую видеоинформацию.
Ниже решение проблемы. Кому не интересно ... ну сами понимаете.
Подмонтировать физическую видеокарту на виртуальную машину "ddatest1"
#Configure the VM for a Discrete Device Assignment
$vm = "ddatest1"
#Set automatic stop action to TurnOff
Set-VM -Name $vm -AutomaticStopAction TurnOff
#Enable Write-Combining on the CPU
Set-VM -GuestControlledCacheTypes $true -VMName $vm
#Configure 32 bit MMIO space
Set-VM -LowMemoryMappedIoSpace 3Gb -VMName $vm
#Configure Greater than 32 bit MMIO space
Set-VM -HighMemoryMappedIoSpace 33280Mb -VMName $vm
#Find the Location Path and disable the Device
#Enumerate all PNP Devices on the system
$pnpdevs = Get-PnpDevice -presentOnly
#Select only those devices that are Display devices manufactured by NVIDIA
$gpudevs = $pnpdevs |where-object {$_.Class -like "Display" -and $_.Manufacturer -like "NVIDIA"}
#Select the location path of the first device that's available to be dismounted by the host.
$locationPath = ($gpudevs | Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths).data[0]
#Disable the PNP Device
Disable-PnpDevice -InstanceId $gpudevs[0].InstanceId
#Dismount the Device from the Host
Dismount-VMHostAssignableDevice -force -LocationPath $locationPath
#Assign the device to the guest VM.
Add-VMAssignableDevice -LocationPath $locationPath -VMName $vm
Демонтаж видеокарты с виртуальной машины "ddatest1" и возврат ее хостовой системе
#Find the Location Path and disable the Device
#Enumerate all PNP Devices on the system
$pnpdevs = Get-PnpDevice -presentOnly
#Select only those devices that are Display devices manufactured by NVIDIA
$gpudevs = $pnpdevs |where-object {$_.Class -like "Display" -and $_.Manufacturer -like "NVIDIA"}
#Select the location path of the first device that's available to be dismounted by the host.
$locationPath = ($gpudevs | Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths).data[0]
#Remove the device from the VM
Remove-VMAssignableDevice -LocationPath $locationPath -VMName ddatest1
#Mount the device back in the host
Mount-VMHostAssignableDevice -LocationPath $locationPath
После многих тестов пришел к решению, что оптимально - смонтировать физическую видеокарту в гостевую машину, особенно, если там работает много народа, кому требуется обработка изображения, например демонстрация видео и карт клиентам.
Вот оно решение, которое меня устроило.
На сервере RDS работает до 25 человек - продавцов путешествий. Все одновременно могут показывать клиентам всякую видеоинформацию.
Ниже решение проблемы. Кому не интересно ... ну сами понимаете.
Подмонтировать физическую видеокарту на виртуальную машину "ddatest1"
#Configure the VM for a Discrete Device Assignment
$vm = "ddatest1"
#Set automatic stop action to TurnOff
Set-VM -Name $vm -AutomaticStopAction TurnOff
#Enable Write-Combining on the CPU
Set-VM -GuestControlledCacheTypes $true -VMName $vm
#Configure 32 bit MMIO space
Set-VM -LowMemoryMappedIoSpace 3Gb -VMName $vm
#Configure Greater than 32 bit MMIO space
Set-VM -HighMemoryMappedIoSpace 33280Mb -VMName $vm
#Find the Location Path and disable the Device
#Enumerate all PNP Devices on the system
$pnpdevs = Get-PnpDevice -presentOnly
#Select only those devices that are Display devices manufactured by NVIDIA
$gpudevs = $pnpdevs |where-object {$_.Class -like "Display" -and $_.Manufacturer -like "NVIDIA"}
#Select the location path of the first device that's available to be dismounted by the host.
$locationPath = ($gpudevs | Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths).data[0]
#Disable the PNP Device
Disable-PnpDevice -InstanceId $gpudevs[0].InstanceId
#Dismount the Device from the Host
Dismount-VMHostAssignableDevice -force -LocationPath $locationPath
#Assign the device to the guest VM.
Add-VMAssignableDevice -LocationPath $locationPath -VMName $vm
Демонтаж видеокарты с виртуальной машины "ddatest1" и возврат ее хостовой системе
#Find the Location Path and disable the Device
#Enumerate all PNP Devices on the system
$pnpdevs = Get-PnpDevice -presentOnly
#Select only those devices that are Display devices manufactured by NVIDIA
$gpudevs = $pnpdevs |where-object {$_.Class -like "Display" -and $_.Manufacturer -like "NVIDIA"}
#Select the location path of the first device that's available to be dismounted by the host.
$locationPath = ($gpudevs | Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths).data[0]
#Remove the device from the VM
Remove-VMAssignableDevice -LocationPath $locationPath -VMName ddatest1
#Mount the device back in the host
Mount-VMHostAssignableDevice -LocationPath $locationPath