Humphry
Contributor
Contributor

get DRS rule conflicts in cluster using web services api

Hi, I'm trying to find a way to retrieve the DRS rules that have conflicts using the web services api.

Humphry_0-1688736200855.png

I've been able to get the DRS rules config in the ClusterComputeResource->configuration->rule:

rule = (vim.cluster.RuleInfo) [
   (vim.cluster.AntiAffinityRuleSpec) {
      dynamicType = <unset>,
      dynamicProperty = (vmodl.DynamicProperty) [],
      key = 4,
      status = <unset>,
      enabled = true,
      name = 'AFLSDKH',
      mandatory = <unset>,
      userCreated = true,
      inCompliance = <unset>,
      ruleUuid = '5224c444-3cd1-084b-54d5-2576b510d49a',
      vm = (vim.VirtualMachine) [
         'vim.VirtualMachine:vm-1040',
         'vim.VirtualMachine:vm-1044'
      ]
   },
   (vim.cluster.AffinityRuleSpec) {
      dynamicType = <unset>,
      dynamicProperty = (vmodl.DynamicProperty) [],
      key = 5,
      status = <unset>,
      enabled = false,
      name = 'asdfasg',
      mandatory = <unset>,
      userCreated = true,
      inCompliance = <unset>,
      ruleUuid = '523fee15-9eaf-0a51-3276-82046d4caaf0',
      vm = (vim.VirtualMachine) [
         'vim.VirtualMachine:vm-1044',
         'vim.VirtualMachine:vm-1040'
      ]
   }
]

But I cannot find anywhere the info about the conflicts of each rule and the vms in conflict.

Does anybody know how to retrieve this info?

Thanks in advance.

 

Labels (2)
Reply
0 Kudos
doskiran
Enthusiast
Enthusiast

When we create Anti-Affinity and then Affinity Rule for the same VMs. The Affinity rule should become invalid(enabled = false) 
i.e. Anti-Affinity conflicting with Affinity Rule.
 
API to get the status:
ClusterComputeResource -> ClusterConfigInfo -> ClusterRuleInfo -> isEnabled()
eg:
boolean status = ruleInfo[1].getInfo().isEnabled();
 
 
enabled (boolean) ==> Flag to indicate whether or not the rule is enabled. Set this property when you configure the rule. The default value is false (disabled). If there is a rule conflict, the Server can override the setting to disable a rule.
Reply
0 Kudos