Hyper‑V Discrete Device Assignment is a Hyper‑V feature
that allows you to pass an entire PCIe hardware device,
examples would be graphics cards, NVMe storage devices, into the VM.
And when I say pass them in,
we're not talking about simply linking like we did in the
previous module, where the enhanced session configuration allows
the VM to get to the host's hard drive.
No,
this is where you're actually giving a piece of hardware
on the host exclusively to the VM.
We configure this using PowerShell. And we just need to know the very
high‑level bird's eye perspective for our exam success.
Basically, you have to configure the VM to support Discrete Device Assignment,
you'll have to work on the host to dismount the device, and then assign the
device to the guest VM. Hyper‑V central processor unit, or CPU, groups allow
an administrator to get better control over the host CPU and the guest VM
access to host CPU. This is analogous to what we did in the previous module
with dynamic memory and different things you can do like memory weighting to
allocate host RAM to your VMs in the way that you want to or that you need to
for your business.
Well, here we have a similar capability, a Quality of Service capability, for
the host CPU. Now, we need to access an API called the Hyper‑V Host Compute
Service, or HCS, and as of this recording in early 2022, and even with the
latest version of Windows Server, Windows server 2022, we don't have a way of
accessing the HCS outside of a separate executable. Microsoft created an
executable called CPU groups that's essentially an abstraction over the Host
Compute Service.
Again,
we don't need to get deep into the weeds here, you just need to identify the
capability if you're asked about it on exam AZ‑800, and basically what you're
doing is using that CPU group's executable to divide logical VM resource groups
into CPU service tiers. I know that the exam AZ‑800 objectives reference
resource groups. There's not a similar concept to Azure resource groups in
Hyper‑V, so I believe what they're talking about, what Microsoft is talking
about there is strictly CPU groups. So we divide our logical VMs into these CPU
service tiers, where you may have one or more VMs that need more CPU power,
just simple as that, and more reserved CPU power than others, and you may also
want to use CPU groups to constrain CPU on VMs to make sure that they don't go
out of bounds. That make sense? I do have just some example usages. I doubt very
seriously you'd see CPU groups syntax on your exam, so I'm giving you this
basically for color. We could do CpuGroups GetCpuTopology just to see what your
current host topology is.
This example shows us creating a group that includes four logical processors.
In other words, these are processor cores on the machine.
Third example shows us how we can set a CPU cap to 50%.
Now, notice that the range is 0 to 65536, so to do a 50% cap,
you specify half that value.
It's a 16‑bit value.
Now, of course, you're probably thinking, whoa, and yeah,
this is not user friendly in the least.
Check the exercise files if you're thinking of actually implementing
this. It's going to have a little learning curve to it, because it's
about as anti‑intuitive as you can get.
So you create your groups that allocate CPU cores from the host,
you create your group properties that customize the behavior and
the quotas of the groups, and then lastly, you bind VMs to the CPU group.