3. Configuring Hyper-V hosts
After you have installed the Hyper-V role on a server, you still
need to configure the role to meet the needs of your environment.
Configuring a Hyper-V host involves steps such as the
following:
-
Configuring virtual machine storage
-
Creating virtual switches
-
Performing other configuration tasks
Hyper-V hosts can also be configured using either the Hyper-V
Manager snap-in or Windows PowerShell cmdlets. To view the
configuration of a host using the Hyper-V Manager snap-in, right-click
on the host in the console tree and select Hyper-V Settings to display
the Hyper-V Settings dialog box shown in the screen shots in this
section. To view the configuration of a host using Windows PowerShell,
use the Get-VMHost cmdlet as shown here:
PS C:\> Get-VMHost -ComputerName HOST4
Name LogicalProcessorCount MemoryCapacity(M) VirtualMachineMigrationEnabled
---- --------------------- ----------------- ------------------------------
HOST4 4 24570.2421875 False
To view all configuration settings associated with the specified
host, pipe the output of the preceding command into the Format-List
cmdlet and specify a wildcard:
PS C:\> Get-VMHost -ComputerName HOST4 | Format-List*
ComputerName : HOST4
VirtualHardDiskPath : C:\Users\Public\Documents\Hyper-V\Virtual
Hard Disks
VirtualMachinePath : C:\ProgramData\Microsoft\Windows\Hyper-V
FullyQualifiedDomainName : WORKGROUP
Name : HOST4
MacAddressMinimum : 00155D0BE600
MacAddressMaximum : 00155D0BE6FF
MaximumStorageMigrations : 2
MaximumVirtualMachineMigrations : 2
VirtualMachineMigrationEnabled : False
VirtualMachineMigrationAuthenticationType : CredSSP
UseAnyNetworkForMigration : False
FibreChannelWwnn : C003FF0000FFFF00
FibreChannelWwpnMaximum : C003FF68F816FFFF
FibreChannelWwpnMinimum : C003FF68F8160000
LogicalProcessorCount : 4
MemoryCapacity : 25763766272
ResourceMeteringSaveInterval : 01:00:00
NumaSpanningEnabled : True
HostNumaStatus : {HOST4}
NumaStatus :
InternalNetworkAdapters : {CONTOSO Virtual Switch}
ExternalNetworkAdapters : {CONTOSO Virtual Switch_External}
IovSupport : False
IovSupportReasons : {Ensure that the system has chipset...
Note that the configuration of virtual switches on a host is not
included in the output of the Get-VMHost cmdlet. To view a list of
virtual switches that have been created on the host, use the
Get-VMSwitch cmdlet as shown here:
PS C:\> Get-VMSwitch
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
CONTOSO Virtual Switch External Broadcom NetXtreme Gigabit Ethernet #2
To view all of the properties of all virtual switches on the
host, use the following command:
PS C:\> Get-VMSwitch | Format-List *
ComputerName : HOST4
Name : CONTOSO Virtual Switch
Id : cffd5106-2735-4c54-b9e1-1cad8944e8c0
Notes :
SwitchType : External
AllowManagementOS : True
NetAdapterInterfaceDescription : Broadcom NetXtreme Gigabit Ethernet #2
AvailableVMQueues : 0
NumberVmqAllocated : 0
IovEnabled : False
IovVirtualFunctionCount : 0
IovVirtualFunctionsInUse : 0
IovQueuePairCount : 0
IovQueuePairsInUse : 0
AvailableIPSecSA : 0
NumberIPSecSAAllocated : 0
BandwidthPercentage : 10
BandwidthReservationMode : Absolute
DefaultFlowMinimumBandwidthAbsolute : 10000000
DefaultFlowMinimumBandwidthWeight : 0
Extensions : {Microsoft NDIS Capture, Microsoft Windows
Filtering Platform}
IovSupport : False
IovSupportReasons : {Ensure that the system has chipset support...
IsDeleted : False
Configuring virtual machine storage
Figure 1
shows the default location where a Hyper-V host stores the virtual
hard disk files for its virtual machines. Such files might include
the following:
-
VHD or VHDX, which can be the system drive or data drives
for each virtual machine
-
AVHD files, which are the differencing disk files used for
virtual machine snapshots
As part of the post-installation configuration of your Hyper-V
hosts, you should change this location to the volume where you want
the virtual hard disk files stored. This volume will depend on the
type of storage solution that you have decided to use for your
Hyper-V hosts.
You can also use the Set-VMHost cmdlet to configure the
virtual hard disk location using Windows PowerShell. For example,
you can use the following command to change the virtual hard disk
location on HOST4 to the E:\VM Storage folder:
Set-VMHost -ComputerName HOST4 -VirtualHardDiskPath "E:\VM Storage"
Figure 2
shows the default location where a Hyper-V host stores its virtual
machine configuration files. Such files can include the
following:
-
XML files named with the globally unique identifier (GUID)
used to internally identify a virtual machine or snapshot
-
BIN files containing the memory of a virtual machine or
snapshot
-
VSV files containing the saved state from the devices
associated with a virtual machine
You can also use the Set-VMHost cmdlet to configure the
virtual machine configuration files location using Windows
PowerShell. For example, you can use the following command to change
the virtual machine configuration files location on HOST4 to the
E:\VM Configurations folder:
Set-VMHost -ComputerName HOST4 -VirtualMachinePath "E:\VM Configurations"
Note
Preventing
problems before they occur
Everyone knows that it’s better to prevent problems from
happening than to try and deal with things after they go wrong.
That’s why it’s important to make sure you configure your default
Hyper-V storage locations appropriately before you start creating
new virtual machines on a Hyper-V host or importing existing
virtual machines onto the host. Ben Armstrong, a Program Manager
on the Hyper-V team at Microsoft, indicates in his “Virtual PC Guy
Blog” that one of the top support-call generators for Hyper-V is
when customers run out of space on their host. This is because the
default locations for storing virtual hard disks and virtual
machine configuration files is the system drive on the host, and
if this drive becomes filled up, the host can fail to function.
Because of the problems that can arise if these default locations
remain unchanged, some changes were made to the Add Roles And
Features Wizard to ensure that customers think about the potential
impact of this issue when they are installing the Hyper-V role.