One of the downsides of the web interface is that it is very difficult to group the disks by array controller when creating a diskgroup. You would have to determine the disks manually and then manually select the disks. From my discussions with VMware TMMs, the only reason to have a diskgroup span PCI controllers is when you have a NVMe device, otherwise they should stay within a PCI device in order to keep that as a unit of failure. In a hybrid configuration, a failure in a ssd results in a failure of the entire diskgroup, thus making that diskgroup a sort-of failure domain.
I wanted to see if I could script the creation of a vsan diskgroup. Luckily I came across a script by Alan Renouf. Unfortunately it only dealt with a single diskgroup and not the multiple diskgroup with one diskgroup per array controller. Also I found a few issues with the script.
Below is my PowerCLI script to create a diskgroup that is aligned with each P440 (or P440ar) controller. If you use different controllers you could probably tweak the script a bit for your needs. All flash would probably need to differentiate the write cache disk bye model or size.
Script is at github (create-VsanHybridDiskGroup.ps1) and below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
$ESXHosts = "host1,host2" Connect-VIServer vcenter.something.com $ESXHosts | Foreach { Write-Host "Finding disks for $($_)" # Find the blank SSDs for the current host $disks = Get-VMHost $_ | Get-VMHostDisk $SSDs = $disks | Where { $_.scsilun.extensiondata.ssd } $BlankSSDs = $SSDs | Where { -not $_.Extensiondata.Layout.Partition[0].partition } #Write-Host "Blank SSDs" $BlankSSDsArray = @() $BlankSSDs | Foreach { $BlankSSDsArray += $_.scsilun.CanonicalName } #$BlankSSDsArray # Find the blank Magnetic disks for the current host $HDDs = $disks | Where { ((-not $_.scsilun.extensiondata.ssd) -and ( $_.scsilun.Vendor -ne "HP iLO")) } $BlankHDDs = $HDDs | Where { -not $_.Extensiondata.Layout.Partition[0].partition } #Write-Host "Blank HDDs" $BlankHDDsArray = @() $BlankHDDs | Foreach { $BlankHDDsArray += $_.scsilun.CanonicalName } #$BlankHDDsArray # Write-Host "all disks" $diskgroup=1 Get-VMHost $_ | Get-VMHostHba | where { $_.Model -like "*P440*"} | Foreach { $LocalSSDArray = @() $LocalSSDString = "" $LocalHDDArray = @() $LocalHDDString = "" $_.ScsiLunUids| %{ $Disk=($_.split("=")[3]).split("/")[0] if($BlankHDDsArray -contains $Disk ) { $LocalHDDArray += $Disk } if($BlankSSDsArray -contains $Disk ) { $LocalSSDArray += $Disk } } write-host "creating diskgroup " $diskgroup " on " $_.vmhost $LocalSSDString = $LocalSSDArray[0] $LocalHDDString = [string]$LocalHDDArray -replace " ","," #$LocalSSDArray[0] #[string]$LocalHDDArray -replace " ","," New-VsanDiskGroup -VMHost $_.vmhost -SSDCanonicalName $LocalSSDString -DataDiskCanonicalName $LocalHDDArray| Out-Null Write-Host "---" $diskgroup+=1 }#foreachHBA |
Pingback: Creating All-Flash Diskgroups on DL380 Gen 9 using PowerCLI | Virtual Chris