Within this excellent resource there is a section for automating round robin policy for all 3PAR LUNs with a custom SATP rule. That’s great, but it involves an esxcli command that must be run on each host:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# esxcli storage nmp satp rule add -s "VMW_SATP_ALUA" -P "VMW_PSP_RR" –O "iops=1" -c "tpgs_on" -V "3PARdata" -M "VV" -e "HP 3PAR Custom Rule" |
For a small number of hosts that’s not too terrible--until you realize that you must either reboot each host or modify the policy for each LUN currently presented. That’s not something that I’m likely to do.
With my aid of my technology buddy Google, I discovered several tidbits online:
- Philip Sellers has a blog that works through much of this in PowerCLI.
- Cormac Hogan has a blog that re-iterates the above, along with the commands required to unload each already claimed device (LUN), reload the claim rules, and rescan the HBAs.
Here’s how I did it for each host:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$esxCred = Get-Credential | |
Connect-VIServer $esx -Credential $esxCred | |
$esxcli = Get-ESXcli | |
# Add the claim rule and test for its existence. This also fails if the claim rule | |
# is already present. | |
try { | |
$esxcli.storage.nmp.satp.rule.add($null,"tpgs_on", | |
"HP 3PAR Custom ALUA Rule", $null, $null, $null, "VV", | |
$null, "VMW_PSP_RR","iops=100", "VMW_SATP_ALUA", $null, | |
$null, "3PARdata") | |
} | |
catch {} | |
if (($esxcli.storage.nmp.satp.rule.list() | | |
where-Object { $_.description -like "*3PAR*" }).count -ne 1) { | |
write-output "Custom claim rule addition failed!" | |
exit | |
} | |
# Get a list of 3PAR devices that aren't configured for RR | |
# and unclaim them | |
$3parDevices = $esxcli.storage.nmp.device.list() | | |
Where-Object { $_.DeviceDisplayName -like "3PARdata*" -and | |
$_.PathSelectionPolicy -notlike "*_RR"} | |
$3parDevices | % { | |
$esxcli.storage.core.claiming.unclaim($null, $null, $null, | |
$_.Device, $null, $null, $null, $null, $null, $null, | |
"device", "3PARdata") | |
} | |
# now reload all claim rules | |
$esxcli.storage.claimrule.load | |
$esxcli.storage.claimrule.run | |
# rescan all HBAs | |
Get-VMHost | Get-VMHostStorage -RescanAllHba |
Of course, I wrapped all of this around more PowerCLI that obtained a list of hosts in each cluster and managed the connections for esxcli.
If you receive any errors during the unclaim, make sure that your HA configuration is not using those LUNs as heartbeat datastores. I experienced that problem which was easy to remedy in our environment.