new1234.jpg
Home > VMware > VMware: Configure Multipath Policy via PowerCLI

VMware: Configure Multipath Policy via PowerCLI

Tonight I need to configure the Multipath Policy from “Most Recently Used” to “Round Robin (VMware) on our vSphere 4.1 and HP EVA6400 environment. After reading “Configuration best practices for HP StorageWorks Enterprise Virtual Array (EVA) family and VMware vSphere 4” I decided to change the path status

To check the status of the Multipath Policy you can run the following PowerCLI script:

Per host:

Get-VMhost ESXHOST | Get-ScsiLun -LunType disk

image

Per Cluster:

Get-Cluster CLUSTERNAME| Get-VMHost | Get-ScsiLun -LunType disk

 

To change the Multipath Policy you can run the following command:

Per Host:

Get-VMHost ESXHOST | Get-ScsiLun -CanonicalName "naa.6005*" | Set-ScsiLun -MultipathPolicy "roundrobin"

image

Result in vCenter:

image

sanderdaems

Sander Daems is founder and author of this blog and working as a Sr. Infrastructure Consultant by IT-Value. Sander has over 10 years experience in IT, primary focus: virtualization, storage and SBC

More Posts - Website

Follow Me:
TwitterLinkedIn

  1. sjaakbananezaak
    May 25th, 2011  (Quote) at 12:25  (Quote) | #1

    Can also do this by using the vSphere Management Assistant before connecting SAN LUN’s to your vsphere host so all LUN’s are default presented with path policy RR:

    esxcli –server nmp satp setdefaultpsp –satp=”VMW_SATP_DEFAULT_AP” –psp=”VMW_PSP_RR”

    Also read this thread for setting iops for HP EVA array’s:

    http://vmug.nl/modules.php?name=Forums&file=viewtopic&t=4893

  2. Stephan
    May 28th, 2011  (Quote) at 05:32  (Quote) | #2

    Great post, used this for my environmet

  3. Robert LeBlanc
    August 2nd, 2011  (Quote) at 22:36  (Quote) | #3

    Here is a faster one-liner:
    get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

  4. August 3rd, 2011  (Quote) at 08:35  (Quote) | #4

    Robert LeBlanc :

    Here is a faster one-liner:
    get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

    Thanks Robert!

  5. Doug Crist
    August 4th, 2011  (Quote) at 15:13  (Quote) | #5

    Robert,

    Your faster one-liner worked for me, but only made the change for the first host in my cluster. The second host remained as it was with some paths as ‘fixed’. I’m fairly new to both PowerShell and PowerCLI, so any help would be appreciated.

    Thanks,
    Doug

  6. Suhail
    November 15th, 2011  (Quote) at 11:32  (Quote) | #6

    Great information, helped in setting for 12 hosts each with 32 disks.

    I wanted to know if there is way to get the LUN nos with the canonical names.

    Thanks,
    Suhail.

  7. November 25th, 2011  (Quote) at 16:12  (Quote) | #7

    The PSP for vSphere 5

    esxcli storage nmp satp set –default-psp VMW_PSP_RR –satp VMW_SATP_ALUA

  8. karlochacon
    April 30th, 2012  (Quote) at 17:59  (Quote) | #8

    Robert LeBlanc :

    Here is a faster one-liner:
    get-cluster “Cluster Name” | Get-VMHost | Get-ScsiLun -LunType disk | Where-Object {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “RoundRobin”

    Just applied this one liner no issues works fine in vsphere 5.

  9. Rohit
    May 25th, 2013  (Quote) at 20:05  (Quote) | #9

    My vCenter server having multiple virtual Data center and multiple cluster, so what is the single command to get detail of All DataStore Multi path policy

  10. May 29th, 2013  (Quote) at 10:19  (Quote) | #10

    This is for vSphere 5.1

    $strHost = Get-VMHost
    connect-viserver $strHost
    $esxcli = $strHost | Get-EsxCLI
    $esxcli.storage.nmp.satp.set($null,”VMW_PSP_RR”,”VMW_SATP_ALUA”)
    $strHost | Get-ScsiLun -CanonicalName “naa.6001*” | Set-ScsiLun -Multipathpolicy “roundrobin”
    $esxcli.storage.nmp.device.list() | Where {$_.PathSelectionPolicy -eq “VMW_PSP_RR”} | %{$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set($null,$true, $_.device, 1,”iops”,$null)}
    $esxcli.storage.nmp.device.list() | Where {$_.PathSelectionPolicy -eq “VMW_PSP_RR”} | %{$esxcli.storage.nmp.psp.roundrobin.deviceconfig.get($_.device)}

  11. May 29th, 2013  (Quote) at 10:57  (Quote) | #11

    Thanks Brian!

  12. Kroman
    June 2nd, 2014  (Quote) at 12:04  (Quote) | #12

    The result is not completely visible with the comannd Get-VMhost ESXHOST | Get-ScsiLun -LunType disk

    How can I make the display completely for the ConsoleDeviceName and CanonicalName

    Thanks, Kroman

  13. Prasad
    January 27th, 2015  (Quote) at 02:29  (Quote) | #13

    @Kroman
    Get-SCSILun -VMhost “ESXi host name” -LunType Disk | Select CanonicalName,CapacityGB,runtimename,MultipathPolicy

  14. felix
    February 24th, 2016  (Quote) at 17:43  (Quote) | #14

    this really saved us A LOT OF time! thank you!!!!

  1. at | #1
  2. at | #2
  3. at | #3