Array Setup and Networking
1825481 Members
3233 Online
109681 Solutions
New Discussion

Set VMware RoundRobin PSP through PowerCLI

 
aherbert23
Trusted Contributor

Set VMware RoundRobin PSP through PowerCLI

This script will create the rule for Nimble volumes to use the RoundRobin PSP policy and set the policy on any existing  Nimble volumes. The script will take an argument of the vCenter server or the ESX host. If it is not provided it will prompt for the host. It will then connect to the vCenter server and get the list of VM hosts. As it connects to each of the hosts it will set the RoundRobin PSP rule and then apply the policy to any of the existing Nimble volumes.

This is a much easier process than enabling SSH on every VM host and copying and pasting the code from the VMware integration guide.

For ESX 4.x hosts this script will need to be run directly against each host rather than the vCenter server.

Here is an example of the script output:

Screen Shot 2013-03-12 at 8.42.21 AM.png

EDIT: Fixed a typo that was keeping the script from setting the vCenter server variable.

EDIT 2: Changed to use IOPS=0 as the path change settings.

EDIT 3: Fixed support for ESX 5.0 hosts

EDIT 4: Updated to support ESX 4.x and direct connections to an ESX host. EsxCli sessions for 4.x hosts cannot be initiated from the vCenter server so this script will have to be initiated directly to each ESX host.

15 REPLIES 15
aherbert23
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

I just fixed a typo in the script that was keeping it from setting the vCenter server variable properly.

kevin_coster
New Member

Re: Set VMware RoundRobin PSP through PowerCLI

Hi Adam, thanks for the script, it had been on my to-do list for some time! I had a couple of issues (ESXi 5):

Only one of --psp or --default can be used

At C:\Temp\832ad4e2-7191-41c8-875c-74806bc48116.ps1:70 char:37

+       $esxcli.storage.nmp.device.set <<<< ($false, $lun.CanonicalName, "VMW_PSP_RR") | Out-Null

The method 'set' is invoked with '6' parameters, but the expected parameter count is '5'.

At C:\Temp\832ad4e2-7191-41c8-875c-74806bc48116.ps1:71 char:58

+       $esxcli.storage.nmp.psp.roundrobin.deviceconfig.set <<<< ($null, $null, $lun.CanonicalName, 0, "iops", $ null) | Out-Null

So made the following adjustments and all was well:

From:

$esxcli.storage.nmp.device.set($false, $lun.CanonicalName, "VMW_PSP_RR") | Out-Null

$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set($null, $lun.CanonicalName, 0, "iops", $null) | Out-Null

To:

$esxcli.storage.nmp.device.set($null, $lun.CanonicalName, "VMW_PSP_RR") | Out-Null

$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set($null, $null, $lun.CanonicalName, 0, "iops", $null) | Out-Null

aherbert23
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

Are you running 5.0?

This may be a 5.0 vs 5.1 issue. I'll do some further testing and put an additional version check in the loop. On my 5.1 lab these parameters work.

kevin_coster
New Member

Re: Set VMware RoundRobin PSP through PowerCLI

Sorry yes, should have been more specific, this was 5.0

Kind regards

Kevin

Brendan Oldham
Occasional Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

Script works great, but setting IOPs to 0 results in performance degradation in my VMware environment. I opened ticket with Nimble. Hopefully, I've got something mis-configured, but I followed the best practices.

J Benway
Advisor

Re: Set VMware RoundRobin PSP through PowerCLI

Brendan Oldham did ever get this figured out?

J Benway
Advisor

Re: Set VMware RoundRobin PSP through PowerCLI

Only a sub section of the ESX servers I have in Vcenter will attach to nimble, should I just run this again each host seperately.

Does this set the host for any new nimble luns with be Round robin?

thanks,jb

aherbert23
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

This will only modify the policy for Nimble volumes. It would be safe to run against a host not connected to the Nimble array.

blaine121
New Member

Re: Set VMware RoundRobin PSP through PowerCLI

Does the change persist after a reboot? This VMware thread says there's a PowerCLI bug that requires an elaborate workaround to make the PSP change stick: Set Default PSP Round Robin ESXi 5.0U1 | VMware Communities

jrich52352
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

so perhaps im not out of my mind then. i've been noticing some of mine reverting back to most recent...

also its easier to set in 5 on,

Get-VMHost | Get-ScsiLun -CanonicalName eui* | Set-ScsiLun -MultipathPolicy RoundRobin

might need to check the canonical name on your system, or filter differently, but the set-scsilun cmdlet makes this easy

aherbert23
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

I have not seen a problem with these settings being retained after reboots so I don't believe this is an issue. I'm not setting the default PSP (as the article you linked) but a PSP rule that only affects Nimble volumes. I don't think that call is plagued by the same bug. The other settings are directly on the device and again not the same issue.

jrich52352
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

I cant say for sure if i am or not. but i could have sworn i had previous set all my paths to RR. perhaps i didnt but, this time im sure, so im going to keep an eye on it.

Brendan Oldham
Occasional Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

After some research, it looks like the performance bottleneck is our Cisco 2960 switches. Apparently, they can't handle the traffic when IOPs were set to 0, so I set IOPs back to default. They perform fine in our environment (municipal government) using VMware defaults.

wen35
Trusted Contributor

Re: Set VMware RoundRobin PSP through PowerCLI

I just shameless modified Adam's script to try out esxcli storage command to list all MPIO settings/info after executing his script to change from PSP_MRU to PSP_RR & setting iops=0   it worked great - all I added was "$esxcli.storage.nmp.device.list()"

great error checking on your script Adam! 

tcrowley96
New Member

Re: Set VMware RoundRobin PSP through PowerCLI

Brendan,

What type of performance issues were you getting as I also have Cisco 2960 switches.

I have been told the buffer size is to small on the 2960 and this increases the latency.

Tim