Tuesday, October 11, 2011

Managing Path Policies with esxcli

Managing Path Policies with esxcli
Policy Description
VMW_PSP_FIXED
The host always uses the preferred path to the disk when that path is available. If the host cannot access the disk through the preferred path, it tries the alternative paths. If you use the VMW_PSP_FIXED policy, use esxcli nmp fixed to set or get the preferred path VMW_PSP_FIXED_AP Extends the VMW_PSP_FIXED functionality to activepassive and ALUA mode arrays.

VMW_PSP_MRU
The host uses a path to the disk until the path becomes unavailable. When the path becomes unavailable, the host selects one of the alternative paths. The host does not revert back to the original path when that path becomes available again. There is no preferred path setting with
the MRU policy. MRU is the default policy for activepassive storage devices and is required for those devices.

VMW_PSP_RR
The host uses an automatic path selection algorithm rotating through all available paths. This algorithm implements load balancing across all the available physical paths. Load balancing is the process of spreading server I/O requests across all available host paths. The goal is to optimize performance in terms of throughput (I/O per second, megabytes per second, or response times).


To change the path policy
1 List all multipathing plugins loaded into the system.
vicfg-mpath <conn_options> --list-plugins
At a minimum, this command returns NMP (Native Multipathing Plugin) and MASK_PATH. If other MPP plugins have been loaded, they are listed as well.
C:\>vicfg-mpath.pl --server esx1  --username root --password esxsvr40  --list-plugins
MASK_PATH
NMP

2 Set the path policy using esxcli.
esxcli <conn_options> nmp device setpolicy --device naa.xxx --psp VMW_PSP_RR

3 (Optional) If you specified the VMW_PSP_FIXED policy, you must make sure the preferred path is set correctly.
a First check which path is the preferred path for a device.
esxcli <conn_options> nmp fixed getpreferred --device naa.xxx

C:\>vicfg-scsidevs.pl --server esx1  --username root --password esxsvr40  --uids
Primary UID                                                     Other UID
mpx.vmhba32:C0:T0:L0                                   vml.0005000000766d68626133323a303a30
t10.F405E46494C45400A645A56644F6D23626A435D207248425   vml.01000100006a545a66446f2d63624a532d70424852564952545541
t10.F405E46494C45400259395867725D24567F444D253651786   vml.01000000005239596877522d54764f442d35567168564952545541
mpx.vmhba0:C0:T0:L0                                    vml.0000000000766d686261303a303a30

C:\>esxcli --server esx1  --username root --password esxsvr40 nmp fixed  getpreferred --device t10.F405E46494C45400A645A56644F6D23626A435D207248425
vmhba33:C1:T0:L1


b If necessary, change the preferred path.
esxcli <conn_options> nmp fixed setpreferred --device naa.xxx --path vmhba3:C0:T5:L3
The command sets the preferred path to vmhba3:C0:T5:L3

C:\>esxcli --server esx1  --username root --password esxsvr40 nmp fixed  getpreferred --device t10.F405E46494C45400A645A56644F6D23626A435D207248425
vmhba33:C1:T0:L1

C:\>vicfg-mpath.pl --server esx1  --username root --password esxsvr40  --list-paths
t10.F405E46494C45400A645A56644F6D23626A435D207248425 : OPNFILER iSCSI Disk (t10.F405E46494C45400A645A56644F6D23626A435D207248425)
   vmhba33:C1:T0:L1 LUN:1 state:active  iscsi Adapter: iqn.1998-01.com.vmware:esx1-0f770b14  Target: IQN=iqn.2006-01.com.openfiler:tsn.b6998f7991b4 Al
ias= Session=00023d000003 PortalTag=1
   vmhba33:C0:T0:L1 LUN:1 state:active  iscsi Adapter: iqn.1998-01.com.vmware:esx1-0f770b14  Target: IQN=iqn.2006-01.com.openfiler:tsn.b6998f7991b4 Al
ias= Session=00023d000002 PortalTag=1

t10.F405E46494C45400259395867725D24567F444D253651786 : OPNFILER iSCSI Disk (t10.F405E46494C45400259395867725D24567F444D253651786)
   vmhba33:C1:T0:L0 LUN:0 state:active  iscsi Adapter: iqn.1998-01.com.vmware:esx1-0f770b14  Target: IQN=iqn.2006-01.com.openfiler:tsn.b6998f7991b4 Al
ias= Session=00023d000003 PortalTag=1
   vmhba33:C0:T0:L0 LUN:0 state:active  iscsi Adapter: iqn.1998-01.com.vmware:esx1-0f770b14  Target: IQN=iqn.2006-01.com.openfiler:tsn.b6998f7991b4 Al
ias= Session=00023d000002 PortalTag=1

mpx.vmhba32:C0:T0:L0 : Local HL-DT-ST CD-ROM (mpx.vmhba32:C0:T0:L0)
   vmhba32:C0:T0:L0 LUN:0 state:active  Local HBA vmhba32 channel 0 target 0

mpx.vmhba0:C0:T0:L0 : Local VMware, Disk (mpx.vmhba0:C0:T0:L0)
   vmhba0:C0:T0:L0 LUN:0 state:active  Local HBA vmhba0 channel 0 target 0


C:\>esxcli --server esx1  --username root --password esxsvr40 nmp fixed  setpreferred --device t10.F405E46494C45400A645A56644F6D23626A435D207248425 --
path  vmhba33:C0:T0:L1
true

C:\>esxcli --server esx1  --username root --password esxsvr40 nmp fixed  getpreferred --device t10.F405E46494C45400A645A56644F6D23626A435D207248425
vmhba33:C0:T0:L1


To view and manipulate round robin path selection settings
1 Retrieve path selection settings for a device that is using the roundrobin PSP.
esxcli <conn_options> nmp roundrobin getconfig --device na.xxx
2 Set the path selection. You can specify when the path should change, and whether unoptimized paths
should be included.
n Use --bytes or --iops to specify when the path should change, as in the following examples:
esxcli <conn_options> nmp roundrobin setconfig --type "bytes" -B 12345 --device naa.xxx
Sets the device specified by --device to switch to the next path each time 12345 bytes have been sent
along the current path.
esxcli <conn_options> nmp roundrobin setconfig --type=iops --iops 4200 --device naa.xxx
The command sets the device specified by --device to switch after 4200 I/O operations have been
performed on a path.
n Use useANO to specify that the round robin PSP should include paths in the active, unoptimized state
in the round robin set (1) or that the PSP should use active, unoptimized paths only if no active
optimized paths are available (0). If you do not include this option, the PSP includes only active
optimized paths in the round robin path set.

No comments: