Advanced Cluster

EVC with PowerCLI 5.5 R2–Part 2

In this previous post we talked about one of the great new features introduced in PowerCLI 5.5 R2 for configuring EVC, in this post we will continue to show how we can make configuring and using EVC easier with PowerCLI.

Compatibility checks

While configuring EVC on a cluster you will probably need to perform some compatibility checks. Here’s how you can automate them with a script.

Check host’s compatibility with a target EVC mode

You can obtain the key for the desired EVC mode using one of the methods I described earlier.

$vmHost = Get-VMHost ‘MyVMHost’

$evcModeKey = ‘intel-westmere’

$availableEVCModes = $viServer.ExtensionData.Capability.SupportedEVCMode

$targetEVCMode = $availableEVCModes | ?{$_.Key -eq $evcModeKey}

$hostMaxEvcMode = $availableEVCModes | ?{$_.Key -eq $vmHost.MaxEVCMode}

$hostIsEVCCompatible = ($targetEVCMode.Vendor -eq $hostMaxEvcMode.Vendor) -and

($targetEVCMode.VendorTier -le $hostMaxEvcMode.VendorTier)


Detect VMs on a host that are incompatible with a target EVC mode

$incompatibleVMs = @()

if ($targetEVCMode.VendorTier -lt $hostMaxEvcMode.VendorTier)

{

$incompatibleVMs = Get-VM -Location $vmhost |

? {$_.PowerState -eq ‘PoweredOn’ -or $_.PowerState -eq ‘Suspended’}

}

My EVC configuration check list

In this section I have outlined the steps for configuring EVC in different scenarios. For steps that require some kind of compatibility check, you can use the sample scripts from the previous section.

Adding a host to an EVC enabled cluster

1. Check if the host you are adding is compatible with the current EVC mode of the cluster.

2. If the host’s CPU feature set is greater than the EVC mode of the cluster, ensure that the host has no powered-on or suspended virtual machines. If the check returns any incompatible VMs you will have two options:

· Migrate incompatible VMs to another host

· Power off incompatible VMs, add the host to the cluster and then power back on the VMs.

Enable EVC on a cluster

1. Select a desired EVC mode for the cluster

2. Detect hosts within the cluster that are incompatible with the selected EVC mode

3. Move incompatible hosts out of the cluster

4. Set the EVC mode

Raise the EVC mode of a cluster

1. Make sure all hosts in the new cluster support the new EVC mode

2. Move incompatible hosts out of the cluster

3. Set the EVC mode

Just keep in mind that all running VMS will not have access to the CPU features available in the new EVC mode until they are powered off and powered back on

Lower the EVC mode of a cluster

1. Power off any VMs on any hosts in the cluster that are incompatible with the new EVC mode

2. Set the EVC mode

A small EVC helper script

Finally, I have prepared a couple of high-level PowerShell functions that will help you automate your process, download the script containing the helper functions from here.

Detect what is the maximum EVC mode that can be set on an existing cluster

This is helpful when you want to determine your cluster EVC readiness depending on the EVC capabilities of the hosts in that cluster.

Function name: Get-MaxEVCModeKey
Returns the maximum EVC mode that is supported by all of the specified VM hosts
Usage:

$VMHosts = Get-VMHost -Location ‘MyCluster’

Get-MaxEVCModeKey $VMHosts

Select a group of hosts with common EVC capability

This is applicable in two different scenarios:

· To identify compatible hosts that can be added to an EVC enabled cluster

· To identify hosts that are incompatible with a given EVC mode and prevent the cluster from running in that EVC mode

Function name: Get-VMHostByEVCCompatibility

Returns all VM hosts from the specified list that match the specified EVC compatibility criteria

Usage:

$VMHosts = Get-VMHost -Location ‘MyCluster’

Get-VMHostByEVCCompatibility $VMHosts -EvcModeKey ‘intel-westmere’ -IncompatibleVMHosts

$VMHosts = Get-VMHost -Location ‘MyCluster’

Get-VMHostByEVCCompatibility $VMHosts -EvcModeKey ‘intel-westmere’ -CompatibleVMHosts

Check host’s compatibility with a particular EVC mode

Function name: CheckVMHostEVCCompatibility
Checks whether the specified VM host is compatible with the specified EVC mode

List available EVC modes

Function name:GetAvailableEVCModeKeys
Retrieves the keys of all EVC modes that are supported by the specified vCenter Server

Download the script containing these functions from here.

TodorThis post was created by Todor Tsvetkov…

Todor is a developer engineer in the PowerCLI team. He joined VMware and PowerCLI in late 2011 and has since taken active part in analyzing, architecting and developing various features of the product. His contribution to the latest PowerCLI release includes the Tagging and EVC functionality.

Like everyone in the PowerCLI team, he is dedicated on delivering a fully-functional, high-quality product. When not working on PowerCLI, he spends his time roller skating, playing the piano and practicing impro theater.