In a previous post, I discussed how the Web Client makes it difficult to create hybrid diskgroups grouped by array controller. I provided a PowerCLI script to automate diskgroup creation for this case. With All-Flash, the same issues around array controller grouping exists. A new issue that I encountered is that the “new-vsandiskgroup” cmdlet that I used in my previous script does not work with all-flash. The cmdlet expects a single SSD name to the -ssdcanonicalname argument and an array of HDDs as the argument to -datadiskcanonicalname. The cmdlet will check the disk if it is reporting as SSD or HDD.

I was fortunate enough to find a blog post from Rawlinson Rivera where he had a PowerCLI script to stand up an All-Flash VSAN from scratch. What i found is that he does not use the new-vsandiskgroup cmdlet, he uses the get-esxcli cmdlet and then uses esxcli commands to tag the SSD disks as “capacityssd” and then create a VSAN diskgroup out of those disks and a cache SSD. The script is more end-to-end than what I have, so I have extracted the pertinent section and retrofitted my previous script.

Note that I filtered for the P440 array controllers. I also found the model numbers of my SSD drives, but you could also use other methods to differentiate between cache and capacity. I initially differentiated by the size of the SSD (this is probably easier to tweak for different implementations as well). Script create-vsanAllFlashDiskgroup.ps1 is available at Github and below.

if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) { if (Test-Path -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\VMware, Inc.\VMware vSphere PowerCLI' ) { $Regkey = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\VMware, Inc.\VMware vSphere PowerCLI' } else { $Regkey = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware vSphere PowerCLI' } . (join-path -path (Get-ItemProperty $Regkey).InstallPath -childpath 'Scripts\Initialize-PowerCLIEnvironment.ps1') } if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) { Write-Host "VMware modules not loaded/unable to load" Exit 99 } if (!(Get-Module -Name vmware.VimAutomation.storage -ErrorAction SilentlyContinue)){ Import-Module vmware.VimAutomation.Storage } $ESXHosts = @("host1","host2") Connect-VIServer vcenter $ESXHosts | Foreach { Write-Host "Finding disks for $($_)" # Write-Host "all disks" $diskgroup=1 $eh = Get-EsxCli -VMHost $_ #Cache disk is a HPE 800gb disk $cacheDiskModel = "EK0800JVYPN" #capacity disks are 3.2TB disks $capacityDiskModel = "MO3200JFFCL" $disks = $eh.storage.core.device.list() $cacheSSDs = $disks | where { $_.model -eq $cacheDiskModel } $capacitySSDs = $disks | where { $_.model -eq $capacityDiskModel } #adapters are P440 and P440ars $eh.storage.core.adapter.list() | where { $_.Description -like "*P440*"} | % { $localCacheSSDArray = @() $LocalCapacitySSDArray = @() $hba = $_.hbaname $devices= $eh.storage.nmp.device.list() foreach ($device in $devices){ if ($device.workingpaths -like '*'+$hba+'*'){ if ($cacheSSDs | where {$_.device -eq $device.device}){ $LocalCacheSSDArray += $device } elseif ($capacitySSDs | where {$_.device -eq $device.device}){ $LocalCapacitySSDArray += $device } } } #through all devices $LocalCapacitySSDString = $LocalCapacitySSDArray | % { $_.device } $capacitytag=$localcapacityssdarray | %{ $eh.vsan.storage.tag.add(($_.Device), "capacityFlash") } Write-Host "Adding Storage devices to" $_ $adddisks = $eh.vsan.storage.add($LocalCapacitySSDString, ($localcachessdarray[0].device)) if ($adddisks -eq "true") { Write-Host "Disks added" -ForegroundColor Green } Else { Write-Host "Error adding disks: $adddisks" -ForegroundColor Red } } # through hbas $diskgroup+=1 }#foreachhost 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 if ( ! ( Get-Module -Name VMware . VimAutomation . Core -ErrorAction SilentlyContinue ) ) { if ( Test-Path -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\VMware, Inc.\VMware vSphere PowerCLI' ) { $Regkey = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\VMware, Inc.\VMware vSphere PowerCLI' } else { $Regkey = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware vSphere PowerCLI' } . ( join-path -path ( Get-ItemProperty $Regkey ) . InstallPath -childpath 'Scripts\Initialize-PowerCLIEnvironment.ps1' ) } if ( ! ( Get-Module -Name VMware . VimAutomation . Core -ErrorAction SilentlyContinue ) ) { Write-Host "VMware modules not loaded/unable to load" Exit 99 } if ( ! ( Get-Module -Name vmware . VimAutomation . storage -ErrorAction SilentlyContinue ) ) { Import-Module vmware . VimAutomation . Storage } $ESXHosts = @ ( "host1" , "host2" ) Connect-VIServer vcenter $ESXHosts | Foreach { Write-Host "Finding disks for $($_)" # Write-Host "all disks" $diskgroup = 1 $eh = Get-EsxCli -VMHost $_ #Cache disk is a HPE 800gb disk $cacheDiskModel = "EK0800JVYPN" #capacity disks are 3.2TB disks $capacityDiskModel = "MO3200JFFCL" $disks = $eh . storage . core . device . list ( ) $cacheSSDs = $disks | where { $_ . model -eq $cacheDiskModel } $capacitySSDs = $disks | where { $_ . model -eq $capacityDiskModel } #adapters are P440 and P440ars $eh . storage . core . adapter . list ( ) | where { $_ . Description -like "*P440*" } | % { $localCacheSSDArray = @ ( ) $LocalCapacitySSDArray = @ ( ) $hba = $_ . hbaname $devices = $eh . storage . nmp . device . list ( ) foreach ( $device in $devices ) { if ( $device . workingpaths -like '*' + $hba + '*' ) { if ( $cacheSSDs | where { $_ . device -eq $device . device } ) { $LocalCacheSSDArray += $device } elseif ( $capacitySSDs | where { $_ . device -eq $device . device } ) { $LocalCapacitySSDArray += $device } } } #through all devices $LocalCapacitySSDString = $LocalCapacitySSDArray | % { $_ . device } $capacitytag = $localcapacityssdarray | % { $eh . vsan . storage . tag . add ( ( $_ . Device ) , "capacityFlash" ) } Write-Host "Adding Storage devices to" $_ $adddisks = $eh . vsan . storage . add ( $LocalCapacitySSDString , ( $localcachessdarray [ 0 ] . device ) ) if ( $adddisks -eq "true" ) { Write-Host "Disks added" -ForegroundColor Green } Else { Write-Host "Error adding disks: $adddisks" -ForegroundColor Red } } # through hbas $diskgroup += 1 } #foreachhost