This used to work in vSphere4, but doesn't seem to be working now
$esxCli = Get-EsxCli
$esxCli.nmp.satp.setdefaultpsp(“VMW_PSP_RR”, “VMW_SATP_DEFAULT_AA”)
Error:You cannot call a method on a null-valued expression.
At C:\Documents and Settings\tclavell\Local Settings\Temp\3\f86a383f-6bcb-4426-
887f-d8534bc291a1.ps1:3 char:31
+ $esxCli.nmp.satp.setdefaultpsp <<<< ("VMW_PSP_RR", "VMW_SATP_DEFAULT_AA")
+ CategoryInfo : InvalidOperation: (setdefaultpsp:String) [], Run
timeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Version:
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.0.1 build 581491
---------------
Has the PSP for Round Robin Changed? According to my ESXi 5.0U1 Host, I can't even locate the PSP any longer. Are we to use
VMW_PSP_FIXED
~ # esxcli storage nmp satp list
Name Default PSP Description
------------------- ------------- -------------------------------------------------------
VMW_SATP_ALUA VMW_PSP_MRU Supports non-specific arrays that use the ALUA protocol
VMW_SATP_EVA VMW_PSP_FIXED Supports HP EVA
VMW_SATP_MSA VMW_PSP_MRU Placeholder (plugin not loaded)
VMW_SATP_DEFAULT_AP VMW_PSP_MRU Placeholder (plugin not loaded)
VMW_SATP_SVC VMW_PSP_FIXED Placeholder (plugin not loaded)
VMW_SATP_EQL VMW_PSP_FIXED Placeholder (plugin not loaded)
VMW_SATP_INV VMW_PSP_FIXED Placeholder (plugin not loaded)
VMW_SATP_ALUA_CX VMW_PSP_FIXED Placeholder (plugin not loaded)
VMW_SATP_SYMM VMW_PSP_FIXED Placeholder (plugin not loaded)
VMW_SATP_CX VMW_PSP_MRU Placeholder (plugin not loaded)
VMW_SATP_LSI VMW_PSP_MRU Placeholder (plugin not loaded)
VMW_SATP_DEFAULT_AA VMW_PSP_FIXED Supports non-specific active/active arrays
VMW_SATP_LOCAL VMW_PSP_FIXED Supports direct attached devices
~ #
The script is fine and will work.
As Vitali mentions; I think the problem still is within this line:
$esxCli.storage.nmp.satp.set($false,$psp,$satp)
"It is possible that there's a problem with the boolean parameter - no matter what value is passed to the it is treated as true, in other words - if there a specified value it is treated as true. In order to pass false no value should be specified."
This means that when you reboot the server, the default Round Robin PSP rule is gone.
Add a new lun after that will result in de default VMware PSP that goes with your storage unit.
you may want to use Vitali's solution until this is fixed.
Did anyone ever find a working solution that holds after reboot?
I love the script-- let's me run this by cluster (I have a lot). Flips existing LUNs (I have lots there too), flips PSP to RR on the hosts.. all good stuff.
I really don't want to ssh into all my hosts.
I'm not sure I understand Vitali's workaround or how to integrate it into the larger script.
Thanks!
You don't have to SSH into all your ESXi hosts, that's where the Get-EsxCli comes in.
With the newer PowerCLI builds you can add the VMHost parameter.
And with the Boot parameter set to true, the default PSP will hold throughout a reboot.
You have to use Vitali's trick to pass the Boot parameter though.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Luc thanks for the reply. My apologies for not being clear in my request. I'm good with the powercli way & passing through the hosts with the VIHost-- where I'm not so clear is how to pass the boot parameter trick.
foreach ($vmhost in $vchosts) {
$esxCli = Get-EsxCli -VMHost $vmhost
$esxCli.storage.nmp.satp.set($false,$psp,$satp)
}
Okay-- So I've spent a little time with this notion today (feeling sick and not like doing much else).
I took Knight's and a few other ideas from google and came up with the script below. The idea here is that I'd like a single script I can execute, provide my VC & Cluster via a GUI prompt, and then specify RR or Fixed, and if I want to update the LUNs and/or the default policy.
Works great except for setting the LUN paths to Fixed-- can't quite figure out how to do cuz I can't figure the logic to set it from RR to Fixed AND get/set the preferred path, all at the same time.
Also, I added some logic to skip LUNs that are already set correctly (saves a bit of time).
Feel free to chime in on the Fixed LUN / Preferred path issue.
Thanks for the ideas!
PS1 attached
Hello Vitali:
Can you confirm if the "pasing the boolean" bug in the Get-ESxcli commlet is now fixed in PowerCLi 5.1 Release 1?
-Clay
I just tested with PowerCLI 5.1 Release 1 and setting boot to 1 still did not retain the setting after reboot.
Unfortunately the normal command to set this($vHcli.storage.nmp.satp.set($true,"VMW_PSP_RR","VMW_SATP_DEFAULT_AA")) has a bug in PowerCLI where the host will not retain these settings after a reboot. Big thanks to vitalibaruh and LucD for providing a great workaround! This will configure Default SATP PSPs for all hosts in your vCenter!
#Setting Default Path Selection Policies for all Hosts
$vHs = Get-VMHost
ForEach($vH in $vHs){
#Getting ESX CLI for each Host
$vHcli = Get-EsxCli -VMHost $vH
#Does it have the correct PSP for IBM SVC
$SVC = $vHcli.storage.nmp.satp.list() | Where {$_.Name -eq "VMW_SATP_SVC" -and $_.DefaultPSP -ne "VMW_PSP_RR"} | Select @{N="Cluster";E={$vH.Parent.Name}},@{N="VMHost";E={$vH.Name}},DefaultPSP,Name
If($SVC.Name -eq "VMW_SATP_SVC" -and $SVC.DefaultPSP -ne "VMW_PSP_RR"){
Write-Host "Configuring $vH SVC"
#Create a low level object that points to the satp namespace:
$LowLevel = $vHcli.TypeManager.CreateDynamicManagedObject( $vHcli.storage.nmp.satp.id )
#Create a hashtable holding parameter values. Note that here we do not specify value for boot parameter:
$Params = @{"DefaultPSP" = "VMW_PSP_RR"; satp = "VMW_SATP_SVC"}
#Invoke set operation on the $LowLevel object:
$LowLevel.InvokeOperation("set",$Params)
}
#Does it have the correct PSP for Defaults
$DAA = $vHcli.storage.nmp.satp.list() | Where {$_.Name -eq "VMW_SATP_DEFAULT_AA" -and $_.DefaultPSP -ne "VMW_PSP_RR"} | Select @{N="Cluster";E={$vH.Parent.Name}},@{N="VMHost";E={$vH.Name}},DefaultPSP,Name
If($DAA.Name -eq "VMW_SATP_DEFAULT_AA" -and $DAA.DefaultPSP -ne "VMW_PSP_RR"){
Write-Host "Configuring $vH Default"
#Create a low level object that points to the satp namespace:
$LowLevel = $vHcli.TypeManager.CreateDynamicManagedObject( $vHcli.storage.nmp.satp.id )
#Create a hashtable holding parameter values. Note that here we do not specify value for boot parameter:
$Params = @{"DefaultPSP" = "VMW_PSP_RR"; satp = "VMW_SATP_DEFAULT_AA"}
#Invoke set operation on the $LowLevel object:
$LowLevel.InvokeOperation("set",$Params)
}
}
Enjoy!
-vFantastic
http://www.knightusn.com/home/massconfiguringpspclearingupsatppartnerpathmisconfiguration