Wednesday, August 6, 2014

PowerCLI: How to Set the Path Selection Policy (PSP) at the host or cluster level

We recently received several new ESXi hosts in one of our datacenters.  Compellent best practices states to use the Round Robin - Path Selection Policy (PSP).  Unfortunately, the ESXi host defaults to Fixed.

The Path Selection Policy must be set at the host level for each datastore.  Soooo.... If your environment is of decent size, it's tedious and time consuming.  

The following steps will make life easier for you.

1. Get the existing configuration for your ESXi host.  Take note of the CanonicalName.

At the Host Level:
Get-VMhost myhost.mycompany.com | Get-ScsiLun -LunType disk

At the Cluster Level:
Get-Cluster mycluster | Get-VMhost | Get-scsiLun -LunType disk


2. To set the PSP, run the following command.  Enter in the appropriate CanonicalName and used the wildcard character.

At the Host Level:
Get-VMHost myhost.mycompany.com | Get-ScsiLun -CanonicalName “naa.XXX*” | Set-ScsiLun -MultipathPolicy “roundrobin”

At the Cluster Level:
Get-Cluster mycluster | Get-VMhost | Get-scsiLun -CanonicalName “naa.XXX*”| Set-ScsiLun -MultipathPolicy “roundrobin”

3. Confirm that the changes have taken place by re-running the command  in Step 1.
 

No comments:

Post a Comment