Automating ESXi configuration for DataCore SANsymphony-V

DataCore describes in their Host Configuration Guide for VMware ESXi some settings that must be adjusted before storage from DataCore SANsymphony-V storage servers will be assigned to the ESXi hosts. Today, for ESXi 5.x and 6.0, you have to add a custom rule and adjust the advanced setting DiskMaxIOSize. For ESX(i) 4 more parameters had to be adjusted. But I will focus on  ESXi 5.x and 6.0. You need to adjust these settings for each host that should get storage mapped from a DataCore storage server. If you have more then one host, you may have the wish to automate the necessary steps. The check the current value of DiskMaxIOSize, you can use this lines of PowerCLI code.

$esxCluster = 'LAB'
$esxHosts = Get-Cluster $esxCluster | Get-VMHost | Where { $\_.PowerState -eq "PoweredOn" -and $\_.ConnectionState -eq "Connected" } | Sort Name

foreach($esx in $esxHosts) {

Get-AdvancedSetting -Entity $esx -Name Disk.DiskMaxIOSize | Select Entity,Name,Value 

}

So set DiskMaxIOSize to the recommended value of 512 and to create the custom SATP rule, use this lines:

$esxCluster = 'LAB'
$esxHosts = Get-Cluster $esxCluster | Get-VMHost | Where { $\_.PowerState -eq "PoweredOn" -and $\_.ConnectionState -eq "Connected" } | Sort Name

foreach ($esx in $esxHosts) {

$esxcli = Get-EsxCli -VMHost $esx
$esxcli.storage.nmp.satp.rule.add($null,"tpgs\_on","DataCore SANsymphony-V Custom ALUA Rule",$null,$null,$null,"Virtual Disk",$null,"VMW\_PSP\_RR",$null,"VMW\_SATP\_ALUA",$null,$null,"DataCore")

Get-AdvancedSetting -Entity $esx -Name Disk.DiskMaxIOSize | Set-AdvancedSetting -Value 512 -Confirm:$false | Out-Null

Write-Host "Finished $esx"

}

Please make sure that you adjust the $esxCluster variable.  Nothing fancy, but it can save some time - even if you only have two hosts. ;)