POWERCLI – ENABLING OR DISABLING VAAI IN A VSPHERE CLUSTER [ATS HeartBeat]

There are limited cases where you would need to do this, but since I’m a huge proponent for scripting anything I do, here is a programmatic (and quick) way to enable or disable VAAI functionality for your vSphere clusters.

Why Disable VAAI?

The first thing you are asking of course, is why on earth would we do this? In vSphere 5.0, there is a bug affecting VAAI enabled systems that could cause a PSOD (Purple Screen of Death). The workaround for this is to upgrade to 5.1 where the problem no longer exists. There may be a patch for 5.0 which comes, but at this point it is still an outstanding issue.

For those of us who can’t jump to the next version at the moment, there is a simple way to disable the VAAI functions which will trigger the PSOD.

Disabling VAAI in the vSphere Client

This can be done in the vSphere Client also, but when you have larger clusters or multiple clusters it can get a little tedious (and error prone) to do this in the GUI. We access the VAAI attributes by opening up the Configuration tab for our host and selecting Advanced Settings:

vaai-advanced

 

Once you are in the Advanced Settings configuration dialog, select the DataMover option in the left hand pane and you will see the two fields in the main window that are HardwareAcceleratedMove and DataMover.HardwareAcceleratedInit:

vaai-settingspage

The option are 0 for disabled or 1 for enabled. One more setting to configure under the VMFS3 option which is VMFS3.HardwareAcceleratedLocking:

vaai-settingspage2

*NOTE*: the settings take effect immediately and do not require a reboot of the host. As soon as you close your Advanced Settings window you will see the task in your vSphere client window.

As I’ve mentioned, this isn’t terribly difficult, but we may have numerous hosts, and maybe even numerous clusters to manage so that is where the magic of PowerCLI comes in.

Script all the things!

My script is simple, and does the following:

  1. Check the current value of the settings for all hosts in the cluster (replace YourClusterName in the script)
  2. Change the properties to be 0 for disabled
  3. Check the current value of the three settings to confirm the new results

 

Here is the script in text format for easier copy and paste. Hope it’s helpful!

# First let’s see the current setting to ensure it is set to 1 (enabled) 

$advSettings =
“DataMover.HardwareAcceleratedMove”,”DataMover.HardwareAcceleratedInit”,”VMFS3.HardwareAcceleratedLocking”

Get-VMHost * |
Get-AdvancedSetting -Name $advSettings |
Select Entity,Name,Value |
Export-Csv report.csv -NoTypeInformation -UseCulture

Note:- Save in .PS1 format and run with PowerCLI

# Now we disable the three options by setting the value to 0 

$clusterName = “MyCluster”

Get-Cluster -Name $clusterName | Get-VMHost | %{
Get-AdvancedSetting -VMHost $_ -Name DataMover.HardwareAcceleratedMove | Set-AdvancedSetting -Value 0 -Confirm:$false
Get-AdvancedSetting -VMHost $_ -Name DataMover.HardwareAcceleratedInit | Set-AdvancedSetting -Value 0 -Confirm:$false
Get-AdvancedSetting -VMHost $_ -Name VMFS3.HardwareAcceleratedLocking | Set-AdvancedSetting -Value 0 -Confirm:$false

}

Note:- Save in .PS1 format and run with PowerCLI

# Confirm the results by querying the values which will show 0 now (disabled)

$advSettings =
“DataMover.HardwareAcceleratedMove”,”DataMover.HardwareAcceleratedInit”,”VMFS3.HardwareAcceleratedLocking”

Get-VMHost * |
Get-AdvancedSetting -Name $advSettings |
Select Entity,Name,Value |
Export-Csv report.csv -NoTypeInformation -UseCulture

Note:- Save in .PS1 format and run with PowerCLI

Happy Scripting!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s