There is a feature of Hyper-V 2012 that is rarely discussed but is highly useful.
First, the Resource Pool concept;
For this I pulled a definition from the Office documentation; “A set of resources that is available for assignment” that is the best way that I can describe it.
Second, this is not VMware style resource pools. Their implementation is very unique. It is closer to the XenServer implementation of resource pools. However, it does not follow that either.
If you head over to the DMTF and search on Resource Pool you find something nice and vague about Resource Pool Hierarchies. Okay, we will see that in the implementation.
So, before I move on, those of you with VMware backgrounds, just forget using resource pools to manage reservations and what not. It might eventually get there, but not today.
As I mentioned in the Office quote, the Resource Pools represent assignment. A connection. A relationship (DMTF).
If you want to see an easy example of the Resource Pools in action (and in the GUI), you need to create one.
The example
Lets look at Networking. Connecting VMs, enabling VMs for all kinds of migrations, and inconsistent configurations.
I have two Hyper-V Servers. They were set up by different folks, with different naming preferences. Joe names his virtual network “VMs” and Gale names hers “LAN”. Each time they move a VM back and forth they need to reconfigure the network settings of the VM.
There has to be a way to do that without renaming their virtual switches. There is. Create an “Ethernet” Resource Pool.
Okay, now some PowerShell and some details
PS C:\Users\Administrator> get-command *resourcepool*
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Get-VMResourcePool Hyper-V
Cmdlet Measure-VMResourcePool Hyper-V
Cmdlet New-VMResourcePool Hyper-V
Cmdlet Remove-VMResourcePool Hyper-V
Cmdlet Rename-VMResourcePool Hyper-V
Cmdlet Set-VMResourcePool Hyper-V
If you have done nothing with Resource Pools on a Hyper-V Server and you simply type Get-VMResourcePool you actually get a bunch back.
PS C:\Users\Administrator> Get-VMResourcePool
Name ResourcePoolType ParentName ResourceMeteringEnabled
---- ---------------- ---------- -----------------------
Primordial FibreChannelConnection False
Primordial FibreChannelPort False
Primordial ISO False
Primordial VFD False
Primordial VHD False
Primordial Ethernet False
Primordial Memory False
Primordial Processor False
These are the Primordial Resource Pools. Hyper-V gives these to you because you can only add children, the Server must provide the first Parent. In this case they called it Primordial. Sounds all medieval doesn’t it? It simply means there is nothing before, it is definitely the Root, not some Pool that someone called “root”.
So, lets make a new Resource Pool and attach it to the Ethernet Primordial Pool.
PS C:\Users\Administrator> New-VMResourcePool -Name "VM LAN" -ResourcePoolType Ethernet
Name ResourcePoolType ParentName ResourceMeteringEnabled
---- ---------------- ---------- -----------------------
VM LAN Ethernet {Primordial} False
Notice how the Primordial pool was assumed in this case? Handy.
Now, I could have explicitly defined –ParentName and I probably would have if I had multiples. Because I could branch Resource Pools if I wanted to.
If I branch Resource Pools I can use them to create logical groupings for metering or connecting devices. And each one would have different options because it is at a different level and combination of parents.
This familial stuff can get pretty messy so I will keep this example simple.
Now that I have my Resource Pool. How do I use it?
Well, now that I created a Resource Pool. If I open the settings of the Network Adapter for any VM on that Hyper-V Server I see something totally new.
And if I drop the selection list I can connect to the Primordial ( “<Root>” ) or the Resource Pool I just created.
If I select the Pool I just created the Virtual Switch setting is changed.
Because I didn't associate a Virtual Switch with my new Resource Pool. This command is not totally intuitive, I expect to use Set-VMSwitch to modify the setting, however, the clever PM behind the Hyper-V cmdlets decided to use a different verb.
PS C:\Users\Administrator> Add-VMSwitch -ResourcePoolName "VM LAN" -Name VMs
Now, If I open the settings of the VM again. It makes sense to select “automatic connection” for the switch. This way the Pool is connected to, not the switch.
I can actually name the switch in some way unique to the server or hardware, and have the consistent naming abstracted above that. So, whatever switch is associated with this Pool, the VM will be connected to it.
What else can I do with that Resource Pool?
Well, I can Measure it of course.
First, enable Metering then measure it.
PS C:\Users\Administrator> Enable-VMResourceMetering -ResourcePoolType Ethernet -Name "VM LAN"
PS C:\Users\Administrator> Measure-VMResourcePool -ResourcePoolType Ethernet -Name "VM LAN"
Name ResourcePoolType AvgCPU(MHz) AvgRAM(M) TotalDisk(M) NetworkInbound(M) NetworkOutbound(M)
---- ---------------- ----------- --------- ------------ ----------------- ------------------
VM LAN {Ethernet} 0 0
Hmm, seems that no time passed, so there is no data. Waiting a bit, lets Measure again.
PS C:\Users\Administrator> Measure-VMResourcePool -ResourcePoolType Ethernet -Name "VM LAN"
Name ResourcePoolType AvgCPU(MHz) AvgRAM(M) TotalDisk(M) NetworkInbound(M) NetworkOutbound(M)
---- ---------------- ----------- --------- ------------ ----------------- ------------------
VM LAN {Ethernet} 2 1
Hey, some network traffic. Excellent.
This is just an introduction to Resource Pools. I hope to bring some more in the future as they are highly useful, yet relatively invisible.