There is no doubt that new pricing introduced to vCAN Service Providers announced just after VSAN 6.2 was released meant that Service Providers looking at VSAN for their IaaS or MSP offerings that had previously written it off due to price, could once again consider it as a viable and price competitive option. As of writing this blog post there is no way to meter the new reporting mechanism automatically through the existing vCloud Usage Meter with the current 3.5 beta also lacking the ability to report billing info.
I had previously come across a post from @virten that contained a PowerCLI script to calculate VSPP points based on the original allocated GB model. With VSAN 6.2 pricing was now based on a consumed GB model which was a significant win for those pushing for a more competitive pricing structure to be able to push a now mature VSAN as a platform of choice.
Before I post the code it’s worth noting that I am still not 100% happy with the interpretation of the reporting:
The VsanSpaceUsage(vim.cluster.VsanSpaceUsage) data object has the following two properties which vCAN partners can use to pull Virtual SAN usage information: a) totalCapacityB (total Virtual SAN capacity in bytes) and b) freeCapacityB (free Virtual SAN capacity in bytes). Subtracting b) from a) should yield the desired “Used Capacity” information for monthly reporting.
I read that to say that you report for any fault tolerance or data resiliency overheads…that is to say if you have a VM with a 100GB hard disk consuming 50GB on a VSAN datastore utilizing RAID1 and an FTT=1 you will pay for the 100GB that is actually consumed.
With that in mind I had to add in a multiplier into the original script I had hacked together to cater for the fault tolerance and raid level you may run. The rest is pretty self explanatory and I have built on @virtens original script by asking for which vCenter you want to log into, what VSAN licensing model you are using and then finally ask for the RAID and FTT levels you are running. The result is the total amount of consumed storage of all VM disks residing on the VSAN datastore (which is the only value hard coded) and then the amount of vCAN points you would be up for per month with and without the overhead tax.
The code is below, please share and improve and note that I provide it as is and should be used as such. Please let me know if I’ve made any glaring mistakes…
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
if (!(get-pssnapin -name VMware.VimAutomation.Core -erroraction silentlycontinue)) { add-pssnapin VMware.VimAutomation.Core } write-host "" $VC=read-host "Enter the VC Name or IP" $VCuser=read-host "Enter in VC Username" $VCpassword=read-host "Enter in VC Password" -AsSecureString $VCpassword_Converted = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($VCpassword)) if (!(Connect-VIServer -Server $VC -user $VCuser -password $VCpassword_Converted)){ Write-Host “Not connected” return } #Connect-VIServer -Server $VC -user $VCuser -password $VCpassword_Converted $datastore = Get-Datastore vsanDatastore $VSPPcapacity = Get-Datastore $datastore | Get-VM | Measure-Object -Property UsedSpaceGB -Sum Write-Host "" Write-Host "What VSAN License Are You Using?" write-host "" write-host " 1. VSAN Standard" write-host " 2. VSAN Advanced" write-host " 3. VSAN Enterprise" write-host "" $answer = read-host "Please Make a Selection" if ($answer -eq 1) { $VSPP_Points='0.04' } elseif ($answer -eq 2) { $VSPP_Points='0.06' } elseif ($answer -eq 3) { $VSPP_Points='0.08' } else { write-host "You choose....poorly" exit } write-host "" Write-Host "What VSAN RAID Level and FTT Are You Using?" write-host "" write-host " 1. FTT = 1 with RAID-1" write-host " 2. FTT = 1 with RAID-5/6" write-host " 3. FTT = 2 with RAID-1" write-host " 4. FTT = 2 with RAID-5/6" write-host "" $answer = read-host "Please Make a Selection" if ($answer -eq 1) { $VSPP_Points_RAID_Factor='2' } elseif ($answer -eq 2) { $VSPP_Points_RAID_Factor='1.33' } elseif ($answer -eq 3) { $VSPP_Points_RAID_Factor='3' } elseif ($answer -eq 4) { $VSPP_Points_RAID_Factor='1.5' } else { write-host "You choose....poorly" exit } write-host "" write-host Consumed Capacity: $([math]::round($VSPPcapacity.Sum)) "GB" write-host "" write-host "vCAN Points per month if measured with overheads : " $([math]::round(($VSPPcapacity.Sum * $VSPP_Points) * $VSPP_Points_RAID_Factor)) write-host “vCAN Points per month if measured without overheads : ” $([math]::round(($VSPPcapacity.Sum * $VSPP_Points))) Disconnect-VIServer $VC -Confirm:$False write-host "" read-host "Hit Enter to Exit" |
If someone can also let me know how to round numbers and capture an incorrect vCenter login gracefully and exit that would be excellent! – [EDIT] Thanks to Virten for jumping on that! Code updated!
References: