I want to set VMW_SATP_ALUA to use VMW_PSP_RR and some other values. The vendor provided this ESXCLI command.
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 “HPE 3PAR Custom Rule"
Source https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-3286ENW.pdf page 9
And I found VMWare KB1017760 which had some information.
The script I am using changes the policy for VMW_SATP_ALUA to VMW_PSP_RR but I have no idea how to change the the elements set by –O “iops=1" -c “tpgs_on" for default
$NEWPSP = "VMW_PSP_RR"
# Setting Curently Loaded SATP
$LoadedSATP = "VMW_SATP_ALUA"
##Load list of hosts to have policy changed on from text file
foreach ($ESXI in (Get-Content -Path C:\PowerShellScripts\esxi-host-list.txt))
{
Write-host "ESXI Host being updated: $ESXI"
$esxcli = get-esxcli -vmhost $ESXI
$esxcli.storage.nmp.satp.set($null,$NEWPSP,$LoadedSATP)
}
I have two scripts that set the policy and IOPS for current LUNS but dont see how to do it for default with powercli. From what I can tell CommandsToSwitchPath and iops are same thing.
#new policy
$NEWPSP = "VMW_PSP_RR"
##Outer Loop
Foreach ($EsxiHost in (Get-Content -Path C:\PowerShellScripts\esxi-host-list.txt))
{
$esxcli = Get-EsxCli -VMHost $esxihost
#Inner Loop
Foreach ($NAA in (Get-Content -Path C:\PowerShellScripts\NAA-list.txt))
{
##Set LUN Policy
$esxcli.storage.nmp.device.set($null,$NAA,$NEWPSP)
}
}
foreach ($esxhost in (Get-Content -Path C:\PowerShellScripts\esxi-host-list.txt)) {
Write-host "ESXI Host being updated: $esxhost"
Get-VMHost $esxhost | Get-ScsiLun -LunType disk | Where-Object {$_.Multipathpolicy -like "RoundRobin"} | Set-ScsiLun -CommandsToSwitchPath 1 | Select-Object CanonicalName, MultipathPolicy, CommandsToSwitchPath
}
Thanks in advance for any help.
Michael
The 2 scripts/esxcli commands you have serve different purposes.
The $esxcli.storage.device.set i s to change the policy for a specific LUN.
The $esxcli.storage.nmp.device.set is intended to change the settings, including the iops, on a claimrule.
Also, I would suggest to use the V2 option for Get-EsxCli, the possibilities are extended and it is easier to use.
For a more detailed discussion, see PowerCLI 6.3 R1: Get-ESXCLI Why the V2?
Have a look
# Help on the parameters
$esxcli.storage.nmp.satp.rule.add.Help()
# List the parameters in a hash table
$esxcli.storage.nmp.satp.rule.add.CreateArgs()
# Fill the hash table (optional params are not required)
$sRule = @{
satp = 'VMW_SATP_ALUA'
psp = 'VMW_PSP_RR'
'psp-option' = 'iops=1'
claimoption = 'tpgs_on'
vendor = '3PARdata'
model = 'VV'
description = 'HPE 3PAR Custom Rule'
}
# Call the esxcli command
$esxcli.storage.nmp.satp.rule.add.Invoke($SRule)
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The 2 scripts/esxcli commands you have serve different purposes.
The $esxcli.storage.device.set i s to change the policy for a specific LUN.
The $esxcli.storage.nmp.device.set is intended to change the settings, including the iops, on a claimrule.
Also, I would suggest to use the V2 option for Get-EsxCli, the possibilities are extended and it is easier to use.
For a more detailed discussion, see PowerCLI 6.3 R1: Get-ESXCLI Why the V2?
Have a look
# Help on the parameters
$esxcli.storage.nmp.satp.rule.add.Help()
# List the parameters in a hash table
$esxcli.storage.nmp.satp.rule.add.CreateArgs()
# Fill the hash table (optional params are not required)
$sRule = @{
satp = 'VMW_SATP_ALUA'
psp = 'VMW_PSP_RR'
'psp-option' = 'iops=1'
claimoption = 'tpgs_on'
vendor = '3PARdata'
model = 'VV'
description = 'HPE 3PAR Custom Rule'
}
# Call the esxcli command
$esxcli.storage.nmp.satp.rule.add.Invoke($SRule)
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Thank you for the reply.
I am trying to do two things.
1) I want to create a rule for whenever we add more 3PAR devices in the future. Which is what you have provided. Thank you. One slight catch on the script you provided. When I run the commands provided I get the following.
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
At C:\PowerShellScripts\SET-3PAR-Custom-Rule.ps1:37 char:1
+ $esxcli.storage.nmp.satp.rule.add.Invoke($SRule)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], FormatException
+ FullyQualifiedErrorId : System.FormatException
2) I am trying to fix assigned rules for 3PAR devices already attached to hosts.
Michael
I played with the script provided a little bit.
The Index (zero based) must be greater than or equal to zero and less than the size of the argument list. is caused by 'psp-option' = 'iops=1' If I remove that the rest of the command works or at least runs without error.
Is there another way to set the iops = 1?
Michael
I had another encounter with that error, see Re: ESXCLI Storage NMP SATP Rule Script Error
But I'm not sure if yours has the same cause
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could it be that there is already a rule with that name?
To change the existing devices, can you first check that this returns the correct devices?
If it does, you could change the policy like this
where { $_.StorageArrayType -eq 'VMW_SATP_ALUA' } |
ForEach-Object -Process {
$sSet = @{
device = $_.device
psp = 'VMW_PSP_RR'
}
$esxcli.storage.nmp.device.set.CreateArgs()
}
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD the issue was using 'psp-option' rather than psotion. Thank you very much!
Michael
Foreach ($EsxiHost in (Get-Content -Path C:\PowerShellScripts\esxi-host-list.txt))
{
$esxcli = Get-EsxCli -VMHost $esxihost -V2
# Fill the hash table (optional params are not required)
$sRule = @{
satp = 'VMW_SATP_ALUA'
psp = 'VMW_PSP_RR'
pspoption = 'iops=1'
claimoption = 'tpgs_on'
vendor = '3PARdata'
model = 'VV'
description = 'HPE 3PAR Custom Rule'
}
# Call the esxcli command
$esxcli.storage.nmp.satp.rule.add.Invoke($SRule)
##delete rule
#$esxcli.storage.nmp.satp.rule.remove.Invoke($SRule)
}