PowerCLI Script to Change IOPS Setting for XIV

So this is a bit of a controversial modification to make to the hosts connecting to IBM XIV storage.  By default when using the Round Robin multipath policy in VMware (as advised for IBM XIV Storage), the path will only change after receiving 1000 IOPS.  The controversy begins around the decision to modify this setting.

Some users have experienced significant performance improvements especially when performing backups, on some storage arrays, by modifying this setting to a lower amount… some even suggest modifying this down to 1 IOP, meaning that the path would change on each IOP… I wouldn’t advise making the change to such a low level but luckily this setting has made an appearance in the IBM XIV configuration documentation, meaning that there is an advised setting for IBM XIV.  The setting advised by IBM themselves is to modify the setting down to 10 IOPS.

This modification cannot be made through the GUI in any way, that I could find, and therefore can either be done from the command line on each host to each LUN or using the following PowerCLI script to make the modification on all of your hosts in a datacenter and all of the XIV LUNs… this script can also be tweaked to be used for other storage arrays.

## Script Variables
$VC = Read-Host 'Please Enter VirtualCenter Name'
$mycluster = Read-Host 'Please Enter The Cluster Name or DataCenter'
$DiskID = "eui.001738"
### Connect to VirtualCenter
Connect-VIServer $VC | Out-Null
### Loop Through Cluster or DC to get ESXCLI instances and run commands
$esxHosts = Get-VMHost -Location $mycluster | Sort Name
foreach($esx in $esxHosts)
{
 ### $esxcli.system.hostname.get() ###
$esxcli = Get-EsxCli -VMHost $esx
 $esxcli.storage.nmp.device.list() | where {$_.Device -match $DiskID}| % {$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set(0,$null,$_.Device,10,"iops",0) }
}
#Disconnect from VirtualCenter
Disconnect-VIServer $VC -Confirm:$false | Out-Null

When running this script, you are first presented with a request for the vCenter server to connect to and then the Cluster Name or Datacenter… after that it will run through all of the XIV LUNs and modify them to be set to 10 IOPS but only if their multipath policy is already configured as Round Robin.  Please also note that this script is designed to work with ESXi 5.1 as there were some modifications made to the storage configuration area between 5.0 and 5.1

If you wish to modify the actual IOP value then this is performed by changing the following line:

{$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set(0,$null,$_.Device,10,"iops",0) }

The bold figure is the item that needs to be changed.

This script is modified from a VMware Community Forum post but unfortunately I cannot remember who the poster was.

Leave a Reply

Your email address will not be published. Required fields are marked *