VMware Cloud Community
toon97
Enthusiast
Enthusiast
Jump to solution

ESXi 5 - Set Roundrobin multipathing policy on all LUNs

Hi all,

Does anyone know of an esxcli command to set the multipathing policy on ALL current and new datastores on a host to Roundrobin??

We have been able to do this in ESXi 4 with the following command, but this no longer works in 5:

esxcli nmp satp setdefaultpsp --satp VMW_SATP_EQL --psp VMW_PSP_RR

esxcli corestorage claimrule load

esxcli corestorage claimrule run

Thanks,

1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

Instead of

esxcli nmp satp setdefaultpsp --satp VMW_SATP_EQL --psp VMW_PSP_RR

you may want ot use

esxcli storage nmp satp set --default-psp VMW_PSP_RR --satp VMW_SATP_EQL

André

View solution in original post

14 Replies
lamw
Community Manager
Community Manager
Jump to solution

With ESXi 5, the esxcli namespaces have slightly changed for the "corestorage"

esxcli nmp .... should be esxcli storage nmp

and

esxcli corestoreage .... should be esxcli storage core

Always good to check out the documentation Smiley Happy

toon97
Enthusiast
Enthusiast
Jump to solution

Hi, i see what you mean, but with that first alteration it still doesnt work!...........

Error. Unknown command or namespace storage nmp satp setdefaultpsp

Any further thoughts??

Thanks

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Instead of

esxcli nmp satp setdefaultpsp --satp VMW_SATP_EQL --psp VMW_PSP_RR

you may want ot use

esxcli storage nmp satp set --default-psp VMW_PSP_RR --satp VMW_SATP_EQL

André

toon97
Enthusiast
Enthusiast
Jump to solution

Thanks Andre, that worked a treat!

0 Kudos
akyster
Contributor
Contributor
Jump to solution

How to do this from PowerCLI?

$esxcli.storage.nmp.satp.set() takes 3 parameters, which should be ...?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

I'd suggest you start a new discussion in the VMware vSphere™ PowerCLI forum with your question. This way you may get more attention.

André

0 Kudos
allencrawford
Enthusiast
Enthusiast
Jump to solution

Sorry for responding to an old/dead thread, but I have a couple of comments/updates as I was dealing with this problem today (just getting started on our 5.0 upgrade).

You mention that it is good to check the documentation (true for sure) but unfortunately in this case the docs are a little weak in this area (or maybe just hard to find).  I searched through a handful of them today and eventually found this one:

http://pubs.vmware.com/vsphere-50/topic/com.vmware.ICbase/PDF/vsphere-esxi-vcenter-server-50-command...

On page 16 you can see where it shows the comparison of esxcli commands from 4.x to 5.0.  The one we care about is:

nmp satp setdefaultpsp [--boot | --psp | --satp]

The 4.x version is the same as the 5.0 version per the docs, but that just isn't true.  5.0 should read:

nmp satp set [--boot | --psp | --satp]

With PowerCLI it is even more different, which I'll describe in reply to the other guy's question about doing it PowerCLI.

One thing still lost on me is the "--boot" option.  Anyone know what that does?  The vMA tells you this:

This is a system default rule added at boot time. Do not modify esx.conf or add to host profile.

This doc tells you the same thing (search for the string "storage nmp satp set" to find it).

Anyone have a clue what this means or where I could go to find the answer?

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Hi allencrawford,

Thanks for reporting the documentation bug, I'll file this so it can be fixed.

To set a default PSP for SATP (this will only take effect on new LUNs being added or reboot a system for all existing LUNs) for ESXi 5 you need to use the following:

esxcli storage nmp satp set -s <SATP_NAME> -P <PSP_NAME>

I'm not sure what the --boot is used for, let me look into it but for your general purposes going from ESXi 4.x to 5.x syntax, the above command is what you need. As you know this configures the default PSP for your SATP but it will not automatically change all existing LUNs on your host, it will only take effect for either new LUNs or when you perform a system reboot.

To make the change for existing LUNs, you will need to use a different command which sets the PSP for each device.

esxcli storage nmp device set -d <DEVICE> -P <PSP_NAME>

The latter 2 commands you had in your original post is not needed, you're not creating any claim rules which is something completely different.

Hopefully this clears up any confusion

allencrawford
Enthusiast
Enthusiast
Jump to solution

Hey, akyster.  I had this same issue today as I am updating documentation/scripts for fresh ESXi 5.0 installs.  See my note above, but the new parameter (which is the first listed one) is now a boolean parameter named "boot".  I have no idea what this does.  The vMA gave some more info about it, but it doesn't appear to be a required parameter with the esxcli command, so I just set it to $null when using PowerCLI to change things.  Here's the complete script if you want to set this on an entire cluster of hosts.  Just note it will only work for ESXi 5.0, no 4.x hosts.

## Script function: Set default VMware PSP (Path Selection Policy) for specific SATPs (Storage Array Type Plugins)
## Author: vNugglets.com


## Enter the name of the cluster containing hosts you want to change the default PSP on
$strClusterName = "YourCluster"

## Array of SATPs to change
$arrSATPsToChange = @"
VMW_SATP_CX
VMW_SATP_SYMM
"@.Split("`n")

## Define the PSP you want to set on each SATP above (Examples: VMW_PSP_FIXED_AP, VMW_PSP_MRU, VMW_PSP_RR, VMW_PSP_FIXED)
$strPSPName = "VMW_PSP_RR"


## Get all VMHosts in chosen cluster and change the PSP to RR
Get-Cluster -Name $strClusterName | Get-VMHost | Sort-Object Name | ForEach-Object {
    ## Grab EsxCli info for a host
    $objEsxCli = Get-EsxCli -VMHost $_
    ## Change predefined SATPs to the new PSP first by traversing all available SATPs looking for matches
    $objEsxCli.storage.nmp.satp.list() | %{
        $objCurrentSATP = $_
        ## Only change the SATP if it isn't already set correctly and if it is included in our predefined list of SATPs to change
        if (($objCurrentSATP.DefaultPSP -ne $strPSPName) -and ($arrSATPsToChange -contains $objCurrentSATP.Name)) {
            ## List matching SATP before changing its default PSP
            $objCurrentSATP
            ## Change matching SATP to the pre-defined PSP
            $objEsxCli.storage.nmp.satp.set($null,$strPSPName,$objCurrentSATP.Name)
        }
    }
}

Keep in mind that this is set to change the default PSP to round robin for both the EMC CLARiiON (VMW_SATP_CS) and Symetrix (VMW_SATP_SYMM) SATPs, so you will need to change the values in the array at the top of the script to suit your environment.

lamw
Community Manager
Community Manager
Jump to solution

The --boot flag is to specify system default rules, a case when you would use this is to remove the system rule by specify this flag. You can refer to this thread for an example - http://communities.vmware.com/message/1831541

The system default rules can not be deleted permanately (will not persist through a reboot) but you can remove them by specifying the -b flag.

0 Kudos
ChaseHansen
Enthusiast
Enthusiast
Jump to solution

Can this script be modified to handle setting iops value before changing paths? I found another script but was unable to get it to work with my limited powercli knowledge.

DeeSaR
Contributor
Contributor
Jump to solution

Hi all,

i know it`s a little late but i missed the answer to the original question to set the multipathing policy on ALL current and new datastores with esxcli (not power cli).... so you can enter it at the local ESXi shell or by ssh.

THIS SYNTAX IS VALID FOR ESXi5 ONLY!

First set the default psp for any new crated datastores to round robin (in this example for the ALUA satp (please check your array vendor)):

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

Next use this little script to set the psp for all existing volumes to round robin.

in this example i look for volumes beginning with naa.600 (this is for HP EVA Volumes, you have to check the naa.xxx for your array vendor):

for i in `esxcli storage nmp device list | grep naa.600` ; do esxcli storage nmp device set --device $i --psp VMW_PSP_RR; done

You have to enter this command in one line!

Finally you can set the path-change-frequency from 1000 IOps (default) to 1 so every IO the other (optimized) path is used:

for i in `esxcli storage nmp device list | grep naa.600` ; do esxcli storage nmp psp roundrobin deviceconfig set -t iops -I 1 -d $i; done

Again, you have to edit the naa.xxx according to your array vendor!

I hope it helps!

TCampUT
Contributor
Contributor
Jump to solution

DeeSar, Thanks for putting everything together!

Not sure why the grep still lets other lines through.  But for the grep to work, use the following command:

for i in `esxcli storage nmp device list | grep "^naa.600"` ; do echo $i; esxcli storage nmp psp roundrobin deviceconfig set -t iops -I 1 -d $i; done

That will filter out any line that doesn't start with naa.600.  I also added the "echo $i" in there so you can see some progress instead of just errors.

ovenwolv
Contributor
Contributor
Jump to solution

Thanks a ton!  This saved me a lot of clicking!

0 Kudos