Path selection policy experience and powercli

In this post i will discuss on how to change the PSP (path selection policy) for FC luns.

The PSP determines how an ESXi host will send data to the FC storage. The default (in my scenario which is HDS) is FIXED.

FIXED is usually used for active / active array (i will not get in to details here about arrays differences) and the idea is that all paths are active but IO goes over only one of the paths. If a fail over occurs the IO will switch to one of the other paths and stay there. The problem with that policy is that the FC ports are not balanced, some of them are very utilized and some not. The other problem is that it is not best practice by VMware or HDS. The best practice is to use RoundRobin , which basically means the ESXi uses all paths and sends specific number of IO commands to each path and moves on to the next one, that way all paths are utilized.

Here is the FC ports utilization when using the FIXED psp:


This configuration can be done using the FAT / web client, but since i have too many ESXi’s and too many LUN’s i decided to go the powercli way.

At first i tried to use the set-scsilun command, and ran it on all LUN’s and ESXi’s in the cluster – something like this:

#### you can filter the luns based on needs

$luns = get-vmhost -name esxi1 | get-scsilun

$esxihosts = get-cluster -name cl | get-vmhost

foreach ($lun in $luns)


foreach ($esxi in $esxihosts)


$esxi | get-scsilun -canonicalname $lun.canonicalname | set-scsilun -multipathpolicy “roundrobin”

write-host ($, $lun.canonicalname)



This script works well, but is very slow, each command takes about ~2 minutes. It would have taken me the whole weekend or even more just to change one of my clusters. So i decided i have to find a better way to do it, so i researched on other methods and came across the get-esxcli cmdlet , which i can to accomplish the same task but in a different way, i can change the inner loop in my script to this:

$esxcli = get-esxcli -vmhost $esxi

$ ($null,$lun.canonicalname, “roundrobin”)

write-host ($, $lun.canonicalname)

It has the same outcome only much faster, each command takes less than 1 second, that means that the script took ponly couple of minutes to run, which is what i wanted.

Here is the utilization after the PSP was changed:


I even took one that shows how the utilization gets even:


Pretty nice, i think.

The get-esxcli cmdlet is quite powerful, it can be used to configure many things on ESXi’s, and to do it in an efficient way.

There is not a lot of documentation about it but its similar to the “esxcli” shell command, so its not too hard to figure the syntax.

BTW, there is an additional cmdlet to change the default PSP to roundrobin so new LUN’s will be configured automatically:

## This is satp for hds (can be different depends on array

$psp = “VMW_PSP_RR”


$ ($null,$psp,$satp)

That’s about it, now i use the best practice, and have learned how to use powercli in an efficient way.

Tagged , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: