esxXtremIO.ps1 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # esxXtremIO.ps1 - Configure VMware ESXi for Dell-EMC XtremIO (v1)
  2. # Date : 3rd August 2018
  3. # Created By : mrkips (Cybergavin)
  4. # Description : This is a rudimentary interactive script (prompted for credentials) for ad hoc configuration
  5. # of ESXi hosts for optimal performance with Dell-EMC XtremIO (v1) SAN.
  6. # For Configuration details, refer Chapter 3 in https://support.emc.com/docu56210_XtremIO-Host-Configuration-Guide.pdf
  7. # For ESXi 6.5 U2 onwards, VMware Native MultiPathing (NMP) is set to Round-Robin with switching frequency (iops) of 1 by default.
  8. # Environment : ESXi 6.5 U2, XtremIO XIOS v4, PowerShell 6.1.0, PowerCLI 10
  9. #########################################################################################
  10. #
  11. # Variables
  12. #
  13. $myname=[string] ($MyInvocation.MyCommand.Name)
  14. #
  15. # Usage
  16. #
  17. if ( $args.length -ne 2 )
  18. {
  19. @"
  20. USAGE : ./$myname <vCenter> <ESXi Cluster>
  21. where, <vCenter> = FQDN or IP Address of vCenter
  22. <ESXi Cluster> = Name of ESXi Cluster whose member Hosts are to be configured
  23. EXAMPLE: ./$myname myvcenter LABCLUSTER
  24. "@
  25. exit 100
  26. }
  27. #
  28. # Setup PowerCLI and connect to the vCenter
  29. #
  30. Set-PowerCLIConfiguration -InvalidCertificateAction ignore -ProxyPolicy NoProxy -DefaultVIServerMode Single -ParticipateInCEIP $false -confirm:$false
  31. Connect-VIServer -Server $args[0]
  32. #
  33. # Loop through all powered on and connected ESXi hosts in the ESXi cluster and configure settings
  34. #
  35. $vmhosts = Get-VMHost -Location $args[1] | Where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected"}
  36. foreach ($vmhost in $vmhosts) {
  37. Get-VMhostModule -VMHost $vmhost qlnativefc | Set-VMHostModule -Options "ql2xmaxqdepth=256"
  38. Get-AdvancedSetting -Entity $vmhost -Name Disk.DiskMaxIOSize | Set-AdvancedSetting -Value 4096
  39. Get-AdvancedSetting -Entity $vmhost -Name Disk.SchedQuantum | Set-AdvancedSetting -Value 64
  40. Get-AdvancedSetting -Entity $vmhost -Name DataMover.MaxHWTransferSize | Set-AdvancedSetting -Value 0256
  41. $esxcli = $vmhost | Get-EsxCli -V2
  42. $arguments = $esxcli.storage.core.device.set.CreateArgs()
  43. # Loop through all LUNs and set SchedNumReqOutstanding to be the same as LUN Maximum Queue Depth
  44. foreach ($i in $esxcli.storage.core.device.list.Invoke()){
  45. if ($i.Vendor -eq 'XtremIO' -and $i.DeviceType -eq 'Direct-Access') {
  46. $arguments.schednumreqoutstanding = $i.DeviceMaxQueueDepth
  47. $arguments.device = $i.Device
  48. $esxcli.storage.core.device.set.Invoke($arguments)
  49. }
  50. }
  51. }