When you’re discovering how to get discrete device assignment to work you have some potential bumps that might trip you up. So what are the issues to watch out for when configuring Discrete Device Assignment? We’ll share some here but note this is from testing with Windows Server 2016 Technical Preview 4. Changes can and probably will happen before RTM.
Make sure your VMs are running on the latest configuration version. That means 7.x at the time of writing. Many of the new features require this as discussed in Windows Server 2016 TPv4 Hyper-V brings virtual machine configuration version 7
Check the configuration version of the VM
When you try to add a GPU to a VM via Discrete Device Assignment you’ll get an error when the VM has version 5.0 in stead of 7.x. This can easily happen when you move VMs from older versions to a shiny new Windows 2016 environment as in the example below:
Naturally all of this is logged in the Hyper-V-VMMS Admin logs as well
‘W2K12R2’ cannot add device ‘Virtual Pci Express Port’ until the virtual machine is upgraded. (Virtual machine ID 592A920F-B0E9-480C-9052-A397B377BCC9)
Mind your Dynamic Memory settings
Another thing you need to watch out for is that when you use dynamic memory the startup memory and the minimum memory values have to match. So minimum memory cannot be lower than the startup memory. Do not that this is TPv4 and things might change.
Cannot add the device to ‘W2K12R2’ as that virtual machine has Dynamic Memory configured with different startup memory and minimum memory values. When adding a device, the virtual machine must be configured with equal startup memory and minimum memory values.(Virtual machine ID 592A920F-B0E9-480C-9052-A397B377BCC9)
If you try to change this on a VM with discrete device assignment enabled you’ll also find that this isn’t allowed.
Cannot perform the operation for ‘W2K12R2’ as the specified memory settings are not compatible for device assignment. The startup memory size and minimum memory size must be equal when Dynamic Memory is enabled and devices are also assigned.(Virtual machine ID 592A920F-B0E9-480C-9052-A397B377BCC9)
Set the automatic stop action to “Turn off the virtual machine”
I already mentioned this in the blog but you need to make sure that the automatic stop action for the virtual machine is set to “turn off the virtual machine and not to the default of “save the virtual machine state”. You cannot use DDA unless you do so.
Cannot add the device to ‘W2K12R2’ as that virtual machine is configured to go to saved state on host shutdown. (Virtual machine ID 592A920F-B0E9-480C-9052-A397B377BCC9)
Again, changing this on a VM that has DDA assigned will not work.
Discrete means one on one
Remember that you cannot assign a device to more than one VM. The thing here is it won’t block you when both VMs are shut down, at least not in TPv4. But It’s dedicated and won’t work. When you do and you try to start any of those VMs it won’t work.
An error occurred while attempting to start the selected virtual machine(s).
‘RFX-WIN10ENT’ failed to start.
Virtual Pci Express Port (Instance ID 9B15DD32-5F94-46EF-8524-501007830322): Failed to Power on with Error ‘The device is in use by an active process and cannot be disconnected.’.
When you try to assign a GPU to a VM that is assigned to a running VM it will block you!
The dive Cleary identifies the VM the device is already assigned to.
Add-VMAssignableDevice -LocationPath $LocationPathOfDismountedDA -VMName RFX-WIN10ENT
Add-VMAssignableDevice : ‘RFX-WIN10ENT’ failed to add resources to ‘RFX-WIN10ENT’.
Virtual Pci Express Port (Instance ID EA7CB907-C38A-4396-97E0-A9A8F3C2D1B0): Failed to Power on with Error ‘The device
is in use by an active process and cannot be disconnected.’.
‘RFX-WIN10ENT’ failed to add resources. (Virtual machine ID 425A366E-E380-4D8C-AADE-DE16EAC0A104)
‘RFX-WIN10ENT’ Virtual Pci Express Port (Instance ID EA7CB907-C38A-4396-97E0-A9A8F3C2D1B0): Failed to Power on with
Error ‘The device is in use by an active process and cannot be disconnected.’ (0x80070964). (Virtual machine ID
Could not allocate the PCI Express device with the Plug and Play Device Instance path
‘PCIP\VEN_10DE&DEV_0FF2&SUBSYS_101210DE&REV_A1\6&17F903&0&00400010’ because it is already in use by another VM.
At line:1 char:1
+ Add-VMAssignableDevice -LocationPath $LocationPathOfDismountedDA -VMN …
+ CategoryInfo : NotSpecified: (:) [Add-VMAssignableDevice], VirtualizationException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.AddVmAssignableDevice
Shut down your VM to make change to DDA
Last but not least to use DDA (assign, configure) with a VM you have to shut it down. Removing devices whilst the VM is running isn’t blocked. But, he results can be quite “harsh”. This is me removing a DDA GPU form a Windows 2012 R2 VM whilst it’s running.
The fun part is that you can add it again while the VM is running and with will work, but it’s not a healthy thing to do.
As stated above, these notes are from testing with Windows Server 2016 Technical Preview 4 so thing can still change. Happy testing!
If you ever remove that device the VM will fail to start, below is how to fix it. I was able to pipe the output of the device into Remove-VMAssignable Device and then it started correctly.
PS C:\Users\Administrator> start-vm BaseWin10
start-vm : ‘BaseWin10’ failed to start.
Virtual Pci Express Port (Instance ID BA1D41AD-128E-4237-8EC0-7AB47555EDB1): Failed to Power on with Error ‘Element not found.’.
‘BaseWin10’ failed to start. (Virtual machine ID 6BD49264-355E-4523-8D30-E9CD9D63BF0F)
‘BaseWin10’ Virtual Pci Express Port (Instance ID BA1D41AD-128E-4237-8EC0-7AB47555EDB1): Failed to Power on with Error ‘Element not found.’ (0x80070490). (Virtual machine ID
Could not find the PCI Express device with the Plug and Play Device Instance path ‘PCIP\VEN_10DE&DEV_128B&SUBSYS_27133842&REV_A1\4&7D0257D&0&0010’.
At line:1 char:1
+ start-vm BaseWin10
+ CategoryInfo : ObjectNotFound: (:) [Start-VM], VirtualizationException
+ FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.StartVM
PS C:\Users\Administrator> help *-VMAssignableDevice
Name Category Module Synopsis
—- ——– —— ——–
Add-VMAssignableDevice Cmdlet Hyper-V …
Get-VMAssignableDevice Cmdlet Hyper-V …
Remove-VMAssignableDevice Cmdlet Hyper-V …
PS C:\Users\Administrator> Get-VMAssignableDevice -VMName BaseWin10
ResourcePoolName : Primordial
VirtualFunction : 0
Name : PCI Express Port
Id : Microsoft:6BD49264-355E-4523-8D30-E9CD9D63BF0F\BA1D41AD-128E-4237-8EC0-7AB47555EDB1
VMId : 6bd49264-355e-4523-8d30-e9cd9d63bf0f
VMName : BaseWin10
VMSnapshotId : 00000000-0000-0000-0000-000000000000
CimSession : CimSession: .
ComputerName : DELLSERVER
IsDeleted : False
VMCheckpointId : 00000000-0000-0000-0000-000000000000
PS C:\Users\Administrator> Get-VMAssignableDevice -VMName BaseWin10 | Remove-VMAssignableDevice
Above workaround will fix the error but the PCIe pass-through setting applied to that specific VM will not work anymore after reboot.
Thanks, that helped me out!
Happy to read it helped you out!