Changing Path Selection Policy for multiple LUNs
search cancel

Changing Path Selection Policy for multiple LUNs

book

Article ID: 323017

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides a method for changing Path Selection Policy (PSP) for multiple LUNs in a command line.

Resolution

Note: The method described here is intended only for very small systems with a single array. It could actually be dangerous in a larger environment as it will set all selected NAA devices to the same PSP. In a heterogeneous environment,  PSP for devices changed indiscriminately, whether or not the PSP specified in the command, is the recommended PSP for a device.

To change Path Selection Policy for multiple LUNs in a command line:
  1. Connect to the host using a Secure Shell (SSH) client.
  2. Run this command to obtain the first common numbers of the naa.id of LUNs on a specific array:

    esxcfg-mpath -l
     
  3. Run this command on a SSH (putty) session:

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

    Note: The above command sets the PSP for all devices matching 'naa.xxxx' to Round Robin. To set PSP to Fixed, replace VMW_PSP_RR  with VMW_PSP_FIXED. To set PSP to Most Recently Used, replace VMW_PSP_RR with MW_PSP_MRU.
     
  4. Repeat Step 2 and 3 for other Storage Array models with the eui.xxxx, t10.xxx or sym.xxx device number prefixes.
     
If the PSP needs to be changed for a family of storage arrays, it is better to change the NMP claim rules so that the default PSP is VMW_PSP_RR as given:

esxcli storage nmp satp set --satp <SATP_Name> --default-psp VMW_PSP_RR

For example:

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

If the device uses a generic SATP (e.g. VMW_SATP_DEFAULT_AA), you may add a claim rule for a specific storage array matching on the vendor's name and/or model string using:

esxcli storage nmp satp rule add --satp <SATP_NAME> --vendor <Vendor_Name> --model <Model_String> --psp <PSP_NAME> --description Manually added to use <PSP_NAME>

For example:

esxcli storage nmp satp rule add --satp VMW_SATP_DEFAULT_AA --vendor HITACHI --model * --psp VMW_PSP_RR --description Manually added to use Round Robin


Additional Information

Run this command to disable paths from vmhba using command line:

for i in 'esxcli storage core path list | grep '^vmhbaXX'` ; do esxcli storage core path set --state off --path $i; done

For Example:
 
for i in 'esxcli storage core path list | grep '^vmhba33'` ; do esxcli storage core path set --state off --path $i; done
 
If the above command does not disable the path from vmhba, try this:

for i in `localcli storage core path list | grep "Runtime Name: vmhba1" | awk '{print $NF}'`; do localcli storage core path set --state off --path $i; done