Multipath to Round Robin on all FC disks in cluster
This will configure multipath to round robin and IOPS to 1 on all disks in a cluster based upon the vendor type. This script is configured for 3par LUNs. Change $vendor for other storage types/vendors.
This commit is contained in:
@@ -2,28 +2,22 @@
|
|||||||
Script name: SetClusterMultiPathToRoundRobin.ps1
|
Script name: SetClusterMultiPathToRoundRobin.ps1
|
||||||
Created on: 09/14/2017
|
Created on: 09/14/2017
|
||||||
Author: Alan Comstock, @Mr_Uptime
|
Author: Alan Comstock, @Mr_Uptime
|
||||||
Description: Set the MultiPath policy for FC devices to RoundRobin for all hosts in a cluster.
|
Description: Set the MultiPath policy for FC devices to RoundRobin and IOPS to 1 for all hosts in a cluster based upon the vendor tag.
|
||||||
Dependencies: None known
|
Dependencies: None known
|
||||||
PowerCLI Version: VMware PowerCLI 6.5 Release 1 build 4624819
|
PowerCLI Version: VMware PowerCLI 6.5 Release 1 build 4624819
|
||||||
PowerShell Version: 5.1.14393.1532
|
PowerShell Version: 5.1.14393.1532
|
||||||
OS Version: Windows 10
|
OS Version: Windows 10
|
||||||
#>
|
#>
|
||||||
|
|
||||||
#Check for any Fibre Channel devices that are not set to Round Robin in a cluster.
|
$pathpolicy="RoundRobin"
|
||||||
#Get-Cluster -Name CLUSTERNAME | Get-VMhost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where { $_.MultipathPolicy -notlike "RoundRobin" } | Select CanonicalName,MultipathPolicy
|
$iops="1"
|
||||||
|
$vendor="3PARdata"
|
||||||
#Set the Multipathing Policy to Round Robin for any Fibre Channel devices that are not Round Robin in a cluster
|
$AllESXHosts = Get-VMHost -Location CLUSTERNAME | Sort Name
|
||||||
$cluster = Get-Cluster CLUSTERNAME
|
Foreach ($esxhost in $AllESXHosts) {
|
||||||
$hostlist = Get-VMHost -Location $cluster | Sort Name
|
Write-Host "Working on" $esxhost
|
||||||
$TotalHostCount = $hostlist.count
|
$scsilun = Get-VMhost $esxhost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where-Object {$_.Vendor -like $vendor -and ($_.MultipathPolicy -notlike $pathpolicy -or $_.CommandsToSwitchPath -ne $iops)}
|
||||||
$hostincrement = 0
|
|
||||||
while ($hostincrement -lt $TotalHostCount){ #Host Loop
|
|
||||||
$currenthost = $hostlist[$hostincrement].Name
|
|
||||||
Write-Host "Working on" $currenthost
|
|
||||||
$scsilun = Get-VMhost $currenthost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType disk | Where { $_.MultipathPolicy -notlike "RoundRobin" }
|
|
||||||
if ($scsilun -ne $null){
|
if ($scsilun -ne $null){
|
||||||
Set-ScsiLun -ScsiLun $scsilun -MultipathPolicy RoundRobin
|
Set-ScsiLun -ScsiLun $scsilun -MultipathPolicy $pathpolicy -CommandsToSwitchPath $iops
|
||||||
}
|
}
|
||||||
$hostincrement++ #bump the host increment
|
|
||||||
}
|
}
|
||||||
#The End
|
#The End
|
||||||
|
|||||||
Reference in New Issue
Block a user