= ALUA for ESXi 5.1 and NetApp Storage =
**Summary**: A post about alua on VMware ESXi and NetApp. \\
**Date**: Around 2019 \\
**Refactor**: 2 January 2025: Checked links and formatting. \\
{{tag>vmware netapp powershell}}
= What You Need to Know About ALUA =
ALUA stands for "Asymmetric Logical Unit Access". ALUA is a SCSI standard and enables vSphere to see optimized and unoptimized paths. \\
\\
Optimized and unoptimized paths occur on active/passive storage arrays. vSphere can see both storage processors for each LUN but only one actually 'owns' the LUN. The optimized paths are the ones with a direct path to the storage processor that owns the LUN. The unoptimized paths have a connection with the storage processor that does not own the LUN but have an indirect path to the storage processor that does own it via an interconnect bus. \\
\\
The pathing policies MRU (Most Recently Used) and RR (Round Robin) both are ALUA aware, so they both take optimized/unoptimized paths into account. When there's no optimized path available both policies will use an unoptimized path, when an optimized path returns they will switch back to the optimized path. Round Robin also switches between the optimized paths (if more than one is available). A 1000 commands (customizable) will be send over one path after which it switches to the next one.
> Note that active/passive arrays rely on the storage administrator to distribute the load over the storage processors.
= Upgrading to ALUA =
Using ALUA is configured in the initiator group. Switching to ALUA is simply a matter of enabling ALUA in the initiator group and rebooting the hosts.
\\
Enabling ALUA in the initiaor group can be done by logging into NetApp OnCommand System Manager, expand storage, click on LUNs and click on the tab Initiator Groups. Select an initiator group and click edit to enable ALUA: \\
[{{alua02.jpg}}] \\
Then, after rebooting the hosts the SATP will be changed to VMW_SATP_ALUA: \\
[{{alua01.jpg}}] \\
> Note: You need to create an initiatorgroup with ALUA enabled on both filerheads, even if all LUNs are on only one of them. If you don't you might see unexpected results, like only half of the paths.
== Through Commandline ==
You can also set ALUA on the commandline:
filer01b> igroup set ESX_DR_Hosts alua yes
filer01b> igroup show -v ESX_DR_Hosts
ESX_DR_Hosts (FCP):
OS Type: vmware
Member: 21:00:00:1b:32:91:XX:XX (logged in on: 4b, 4a, vtic)
Member: 21:00:00:1b:32:91:XX:XX (logged in on: 4d, 4c, vtic)
Member: 21:00:00:1b:32:91:XX:XX (logged in on: 4b, 4a, vtic)
Member: 21:00:00:1b:32:91:XX:XX (logged in on: 4d, 4c, vtic)
Member: 21:01:00:e0:8b:be:XX:XX (not logged in)
Member: 21:00:00:e0:8b:9e:XX:XX (not logged in)
UUID: 3cf464be-3324-11df-a3ca-00a09810XXXX
ALUA: Yes
Report SCSI Name in Inquiry Descriptor: No
= Upgrading to RoundRobin =
If you're going to change the multipathpolicy in your environment, and you have RDMs that are used for Microsoft Clustering Services (MSCS) you should be really careful. Using Round Robin for quorum disk is not supported, as clearly stated in [[http://kb.vmware.com/kb/1010041|this knowledgebase article]]. This means you can't change the path policy from the host, that would also set the policy on RDMs. Because RDMs are no datastores, changing it from the datastore will prevent you from changing RDM policies, which is what you want, and of course we'll do that with powershell.
== Viewing Multipath Policy For All Datastores in a Cluster ==
# Viewing the cluster settings is from http://communities.vmware.com/thread/414102, written by LucD
# Function to display all clusters and then select one
Function ChooseCluster{
$clusterlist = Get-cluster | Sort name
$i = 0
write-host -foregroundcolor green `n "Choose a cluster"
foreach ($clustername in $clusterlist){
write-host -foregroundcolor green "$i - $clustername"
$i++
}
[int]$answer = read-host `n "Enter the number for the cluster you want"
$script:cluster = $clusterlist[$answer]
if (($answer -gt $i-1) -or ($answer -lt 0)){write-host -foregroundcolor red "Input was not on the list. The script will exit now.";exit}
}
ChooseCluster
foreach ($esx in (Get-Cluster $cluster | Get-VMHost | Select $_.Name | Sort Name | Select -First 1 )){
Write-Host "Using $esx"
Get-Datastore -VMHost $esx |
Select @{N="Host";E={$esx.Name}},Name,CapacityMB,
@{N="PathType";E={
Get-ScsiLun -Datastore $_ | Select -First 1 | Select -ExpandProperty MultiPathPolicy
}}
}
== Changing Multipath Policy For All Datastores in a Cluster ==
# Changing the cluster settings is from http://communities.vmware.com/thread/414102, written by LucD
# Function to display all clusters and then select one
Function ChooseCluster{
$clusterlist = Get-cluster | Sort name
$i = 0
write-host -foregroundcolor green `n "Choose a cluster"
foreach ($clustername in $clusterlist){
write-host -foregroundcolor green "$i - $clustername"
$i++
}
[int]$answer = read-host `n "Enter the number for the cluster you want"
$script:cluster = $clusterlist[$answer]
if (($answer -gt $i-1) -or ($answer -lt 0)){write-host -foregroundcolor red "Input was not on the list. The script will exit now.";exit}
}
ChooseCluster
foreach($esx in (Get-Cluster $cluster | Get-VMHost | Select $_.Name | Sort Name | Select -First 1 )){
Write-Host "Using $esx"
Get-Datastore -VMHost $esx | %{
Get-ScsiLun -Datastore $_ |
where {$_.MultiPathPolicy -eq "Fixed"} |
Set-ScsiLun -MultipathPolicy RoundRobin -Confirm:$false
}
}
== Changing Multipath Policy For All LUNs Attached to a Host ==
In case you don't have any RDMs or you're not using MSCS you can also set the multipathpolicy from the host:
Get-ScsiLun -vmhost (Get-Vmhost ) -luntype disk | Set-ScsiLun -multipathpolicy "roundrobin"
== Change RDM Disks From Fixed to MostRecentlyUsed =
Because the fixed policy is not ALUA aware you want to change these paths to MostRecentlyUsed, so those paths will always be optimized as well. If you changes all other paths to round robin using the method above, you could change all disk LUNs that are still on fixed to MostRecentlyUsed. \\
First, find all the disks that are left and check whether they are RDMs:
Per Host:
Get-ScsiLun -vmhost esxhostname -luntype disk | where {$_.multipathpolicy -eq "Fixed"}
Per Cluster:
ForEach ($esxhost in (Get-Cluster "The Netherlands"| Get-vmHost)){Get-ScsiLun -vmhost $esxhost -luntype disk | where {$_.multipathpolicy -eq "Fixed"}}
Secondly, change all the policies to MRU:
Per Host:
Get-ScsiLun -vmhost esxhostname -luntype disk | where {$_.multipathpolicy -eq "Fixed"} | Set-ScsiLun -multipathpolicy "MostRecentlyUsed"
Per Cluster:
ForEach ($esxhost in (Get-Cluster "The Netherlands"| Get-vmHost)){Get-ScsiLun -vmhost $esxhost -luntype disk | where {$_.multipathpolicy -eq "Fixed"} | Set-ScsiLun -multipathpolicy "MostRecentlyUsed"}
> Note that you can do this for all hosts in a datacenter by changing Get-Cluster to Get-DataCenter
= Resources =
http://www.yellow-bricks.com/2009/09/29/whats-that-alua-exactly/ \\
https://communities.netapp.com/thread/10524 \\
https://communities.netapp.com/community/netapp-blogs/storage_nuts_n_bolts/blog/2009/08/26/vsphere-upgrading-from-non-alua-to-alua \\
http://www.gabesvirtualworld.com/changing-netapp-storage-policies-from-non-alua-to-alua/ \\
http://theithollow.com/2012/03/08/path-selection-policy-with-alua/ \\