Calling LucD
I'd like to list SDRS rules, or rather, to determine if a specific one exists for a specific VM. But for the life of me, I've been unable to see them in PowerCLI, I even tried Onyx to give me a hint. This is vCenter 5.1 U1b. I feel that they should be listed in:
$DSCluster.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Rule
But the "Rule" property is empty. Any help?
I think I know what happens, you are following VMDK affinity rules, while the Rule property has the inter-VM rules.
Try this
$dsc = Get-DatastoreCluster -Name DSC1
$dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.VmConfig |
Select Enabled,IntraVmAffinity,IntraVmAntiAffinity,
@{N="VM";E={[string]::Join('/',(Get-View -Id $_.VM -Property Name | Select -ExpandProperty Name))}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This works for me, and afaik this is valid for 5.1.
See the ClusterRuleInfo object in the SDK.
$dsc = Get-DatastoreCluster -Name DSC1
$dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.PodConfig.Rule |
Select Name,Enabled,
@{N="RuleType";E={$_.GetType().Name.TrimEnd('RuleSpec').TrimStart('Cluster')}},
@{N="VM";E={[string]::Join('/',(Get-View -Id $_.VM -Property Name | Select -ExpandProperty Name))}}
You are sure there are some SDRS rules defined :smileyconfused:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Boy, I just don't know what I'm doing wrong. I've got three separate vCenter installs (1x version 5.0, 2x version 5.1 U1b) (all with datastore clusters and a couple rules). I've tested three PowerCLI client systems (one with PowerCLI v5.0), and all exhibit the same symptom.
PS C:\> $DSC = get-vm "dix-q-sptdbs-05" | Get-DatastoreCluster
PS C:\> $dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.PodConfig | select *
Enabled : True
IoLoadBalanceEnabled : False
DefaultVmBehavior : automated
LoadBalanceInterval : 60
DefaultIntraVmAffinity : False
SpaceLoadBalanceConfig : VMware.Vim.StorageDrsSpaceLoadBalanceConfig
IoLoadBalanceConfig : VMware.Vim.StorageDrsIoLoadBalanceConfig
Rule :
Option : {IgnoreAffinityRulesForMaintenance}
DynamicType :
DynamicProperty :
PS C:\> $dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.PodConfig.rule
I think I know what happens, you are following VMDK affinity rules, while the Rule property has the inter-VM rules.
Try this
$dsc = Get-DatastoreCluster -Name DSC1
$dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.VmConfig |
Select Enabled,IntraVmAffinity,IntraVmAntiAffinity,
@{N="VM";E={[string]::Join('/',(Get-View -Id $_.VM -Property Name | Select -ExpandProperty Name))}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes! Thanks LucD, you're the best.
PS C:\> $dsc.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.VmConfig |?{$_.vm -eq $vm.id} | select -ExpandProperty intravmantiaffinity
DiskId : {2016, 2018, 2019}
Key : 118
Status :
Enabled : True
Name : dix-q-sptdbs-05 SQL Disks
Mandatory :
UserCreated : True
InCompliance :
DynamicType :
DynamicProperty :