Last active
January 27, 2016 16:24
-
-
Save TScalzott/34da32b0f06bffc8109a to your computer and use it in GitHub Desktop.
vSphere Claim Rules
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment