Mastering Windows Server 2016 Hyper-V

(Romina) #1

virtual machine. However, if there are 10 virtual machines in a certain group—for
example, all of the virtual machines for a certain client or all of the SQL servers—then
to get the total resource for all of the groups’ virtual machines, you would have to add
all the metrics together manually or write something. This is where the concept of
resource pools can be useful. CPUs, memory, storage (VHD, ISO, Fibre Channel, and
virtual floppy disk), and network adapters can be added to a resource pool from a
number of virtual machines. Once the resources are added to the resource pool,
metering can be enabled for the resource pool and subsequently measured. The one
drawback with resource pools is that they are host-specific, so if virtual machines are
moved between hosts, you would need to ensure that the same resource pools are
available on every node, which is why resource pools are typically not widely used.


By default, numerous resource pools, known as Primordial, exist on the system, which
can be viewed as follows:


PS C:> Get‐VMResourcePool


Name ResourcePoolType ParentName ResourceMeteringEnabled
—— ———————— ————————————————-
Primordial FibreChannelConnection False
Primordial VHD True
Primordial FibreChannelPort False
Primordial VFD False
Primordial ISO False
Primordial Ethernet True
Primordial Memory True
Primordial Processor True
Primordial PciExpress False


A new resource pool is created for each type of resource, but the same resource pool
name is specified, which makes it a single, reportable pool. For example, in the
following code snippet, I create a resource pool for a group of virtual machines,
GroupA, for the four types of resources. Then I add virtual machine CPU and memory
to each created pool, in addition to virtual hard disks and the virtual switch the virtual
machines use. In the following example, I add new hard disks and network adapters to
a VM, but you can also use Set- -ResourcePoolName to set the pool. Notice
that when the VHD resource pool is created, you must specify the path where the
VHDs will be stored.


New-VMResourcePool -Name GroupA -ResourcePoolType Processor
New-VMResourcePool -Name GroupA -ResourcePoolType Memory
New-VMResourcePool -Name GroupA -ResourcePoolType Ethernet
New-VMResourcePool -Name GroupA -ResourcePoolType VHD -Paths @("\\savdalfs01\HVShare") Add-VMSwitch -ResourcePoolName GroupA -Name "External Switch" Set-VMProcessor -VMName savdal08R2 -ResourcePoolName GroupA Set-VMMemory -VMName savdal08R2—ResourcePoolName Group A Add-VMHardDiskDrive -VMName savdal08R2 -ControllerType SCSI
-ResourcePoolName GroupA ` -Path
"\savdalfs01\HVShare\savdal08R2\data1.vhdx"
Add-VMNetworkAdapter -VMName savdal08R2 -ResourcePoolName GroupA

Free download pdf