Configuring VMware pathing via Powershell

We have a fairly large VMware environment with a large number of LUNs. I did some performance reviews the other day and found that most of my FC traffic was passing through only 2 of the 4 ports in my Brocade switches.
This causes 2 problems: 1) I could potentially run into a bottleneck by being limited to IOPs and throughput, and 2) A large number of LUNs will have to fail-over if the primary path fails.

A quick bit of googling popped up the site: This allows for all the LUNs on a single server to be changed to a Round-Robin policy (listed experimental, but still stable). Some tweaking and you could automatically set the preferred path for all LUNs on all servers.

A little more searching found the following script. This changes all LUNs on all servers to RR.

$Mypolicy = "rr"
Get-Datastore | where {$_.Type -eq "VMFS"} | %{(Get-View $_.ID).Info.Vmfs.Extent[0].DiskName} |%{
$diskname = $_
Get-VMHost | %{Get-View (Get-View $_.ID).configmanager.storageSystem} | %{
$mpathpolicy = New-Object vmware.vim.HostMultipathInfoLogicalUnitPolicy
$mpathpolicy.policy = $Mypolicy

Leave a Reply