Skip to content

Commit

Permalink
Update to checking disk cache for ephemeral
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthebrit committed May 13, 2024
1 parent b7693c6 commit 6b2080a
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions AzureVMs/CheckCache.ps1
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
Function HasSupportEphemeralOSDisk([object[]] $capability)
{
return $capability | where { $_.Name -eq "EphemeralOSDiskSupported" -and $_.Value -eq "True"}
}

$location = "southcentralus"

$VMCacheInfo = @()

$VMSKUs = Get-AzComputeResourceSku -Location $location | Where-Object { $_.ResourceType -eq "virtualMachines" } | Where-Object { $null -eq $_.Restrictions.ReasonCode }
$VMSKUs = Get-AzComputeResourceSku -Location $location | Where-Object { $_.ResourceType -eq "virtualMachines" -and (HasSupportEphemeralOSDisk $_.Capabilities) -ne $null }

foreach ($SKU in $VMSKUs)
{
if (($Sku.Capabilities | Where-Object { $_.Name -eq "EphemeralOSDiskSupported" }).Value -eq $true -and ($Sku.Capabilities | Where-Object { $_.Name -eq "PremiumIO" }).Value -eq $true -and $null -ne ($Sku.Capabilities | Where-Object { $_.Name -eq "CachedDiskBytes" }).Value)
{
$VMSKU = New-Object PSObject -Property @{
Name = $Sku.Name
Family = $Sku.Family -replace "standard", ""
CachedDiskBytes = (($Sku.Capabilities | Where-Object { $_.Name -eq "CachedDiskBytes" }).Value / 1GB)
EphemeralOsDiskSupported = [bool]($Sku.Capabilities | Where-Object { $_.Name -eq "EphemeralOSDiskSupported" }).Value
}
$VMCacheInfo += $VMSKU
}
$VMSKU = New-Object PSObject -Property @{
Name = $SKU.Name
Family = $SKU.Family -replace "standard", ""
SupportedEphemeralOSDiskPlacements = (($SKU.capabilities | Where-Object { $_.Name -eq "SupportedEphemeralOSDiskPlacements" }).Value)
CachedDiskGB = (($SKU.capabilities | Where-Object { $_.Name -eq "CachedDiskBytes" }).Value / 1GB)
MaxResourceVolumeGB = (($SKU.capabilities | Where-Object { $_.Name -eq "MaxResourceVolumeMB" }).Value / 1KB)
}
$VMCacheInfo += $VMSKU
}

$VMCacheInfo | Format-Table Name, SupportedEphemeralOSDiskPlacements, MaxResourceVolumeGB, CachedDiskGB -AutoSize


$vmSizes=Get-AzComputeResourceSku | where{$_.ResourceType -eq 'virtualMachines' -and $_.Locations.Contains($location)}

Expand Down

0 comments on commit 6b2080a

Please sign in to comment.