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
~ #
Hi all,
I have several things to add here:
* I've filed a bug for the initial post - the error message is obscure - the message in this case (referring non-existing namespace) should be "There is no namespace with that name"
* About the problem with "boot" parameter - Do you execute the command while you are connected to vCenter server? If yes - try to execute the same command directly against the ESX host. I will research a little bit more about this issue...
Vitali
PowerCLI Team
Troy, I see the same when I do a list(), but I seem to be able to set the default to RR
Or am I missing the point here ?
Btw, there is a 'storage' qualifier that needs to be added since vSphere 5.
And you can now do a 'Get-EsxCli -VMHost $esx' while connected to the vCenter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I think I see the light. So, to set the default PSP we'll need to do something like
$esxcli = Get-EsxCli
$esxcli.storage.nmp.satp.set($false,"VMW_PSP_RR","VMW_SATP_DEFAULT_AA")Name Port User
---- ---- ----
myesxhost.mydomain.com 443 root
Default PSP for VMW_SATP_DEFAULT_AA is now VMW_PSP_RR
Correct, that seems to work for me at least.
And the change in the namespace seems to be confirmed by ESXi 5 - Set Roundrobin multipathing policy on all LUNs
And it corresponds with the esxcli storage doc
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you again sir!
Hi Troy and Luc,
It seems like the changed PSP settings are lost after a reboot of the system.
If it try it directly via the console or remote via VMwareCLi the changed settings are remembered.
Used PowerCLI 5.0 on an ESXi 5.0 build 515841 host.
Any idea's?
Cheers,
Henk
Try changing the first parameter from $false to $true.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
so to make this persistant acrros reboots we need to add the $true? Better update my post install script
That's how I interpret the boot parameter.
But I'm not 100% sure, I could be wrong.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We don't have any new LUNs to present to our hosts at this time, so we'll have to wait until we present a new LUN to see what happens after a reboot. With that said, any existing LUNs that are already Round Robin don't lose the PSP at reboot with the $false
Thanks for the tip!
Hi Luc and Troy,
Thanks for your fast replies.
In my original script I used 1 instead of $true, like this:
$esxcli.storage.nmp.satp.set(1,"VMW_PSP_RR","VMW_SATP_DEFAULT_AA")
The script was also followed by going through all the LUN's and setting the psp.
So far on vSphere 4 we havent had any problems, even after adding LUN's.
Today I'll reinstall the host (just to be sure) and set the value to $true instead of 1.
Just finished reinstalling and trying the script again. Same result; The settings are not remembered.
When using vSphereCLI the settings are rememberd.
Any ideas? Should I file a SR?
Cheers,
You can try Onyx to see what code is generated when you do it in the vSphere client.
Hi Robert,
I don't think it possible to change the default Path Selection Policy for a given Storage Array Type Plugin from within the vSphere Client. What I ment was that I used the vSphere vSphere CLi (the perl scripts).
You can use the vSphere CLI scripts from PowerCLI using the function I made in my blog post How to run VMware vSphere CLI perl scripts from PowerCLI.
That is a nice workaround, but still I very much prefer to use the Get-EsxCli cmdlet and go 100% PowerCLI.
Hi all,
I have several things to add here:
* I've filed a bug for the initial post - the error message is obscure - the message in this case (referring non-existing namespace) should be "There is no namespace with that name"
* About the problem with "boot" parameter - Do you execute the command while you are connected to vCenter server? If yes - try to execute the same command directly against the ESX host. I will research a little bit more about this issue...
Vitali
PowerCLI Team
Hello Vitali,
Thank you for your reply.
The command is directly executed against the ESXi host. No vCenter connections are made.
Hi again,
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.
There's a possible workaround with PowerCLI esxcli.
1. Create a low level object that points to the satp namespace:
PS> $lowLevel = $esxcli.TypeManager.CreateDynamicManagedObject( $esxcli.storage.nmp.satp.id )
2. Create a hashtable holding parameter values. Note that here we do not specify value for boot parameter:
PS> $params = @{ 'defaultpsp' = 'VMW_PSP_RR'; satp = 'VMW_SATP_DEFAULT_AA' }
3. Invoke set operation on the $lowLevel object:
PS> $lowLevel.InvokeOperation("set", $params)
Hope this helps.
Vitali
PowerCLI Team
I've updated my script with the new powercli storage command. Let me know what you think:
#### Variables
$VC = Read-Host "Enter Your vCenter Server"
$cluster = Read-Host "Enter Your Cluster Name"
$psp = "VMW_PSP_RR"
$satp = "VMW_SATP_SVC"
#### Connect to Your vCenter
Connect-viserver $VC
#### Execution Area
#### Change existing luns to Round Robin
Write-Host "Setting the existing luns to Round Robin" -ForegroundColor Cyan
$vchosts = Get-Cluster $cluster | Get-VMHost
foreach ($vmhost in $vchosts)
{
Get-ScsiLun -vmhost $vmhost –luntype disk | where {$_.Vendor -like "IBM"} |
Sort CanonicalName | Set-ScsiLun -MultipathPolicy “RoundRobin”
}
#### Change the default PSP for my SATP
Write-Host "Setting the default PSP to Round Robin" -ForegroundColor Cyan
foreach ($vmhost in $vchosts)
{
$esxCli = Get-EsxCli -VMHost $vmhost
$esxCli.storage.nmp.satp.set($false,$psp,$satp)
}
#### Disconnect from Your vCenter
Disconnect-VIServer $VC -Confirm:$false