Hi
With the imformation above, I managed to get (almost) all informations (properties) about all DRS rules and DRS groups from a specific cluster:
// Get all groups
var varVmGroups = winEsxiCluster.configurationEx.group;
System.log("")
System.log(" *** All Cluster Groups *** ")
System.log(" -------------------------- ")
for (i in varVmGroups) {
System.log("");
System.log("Group Nr.: " + i);
System.log( "Name: " + varVmGroups[i].Name);
for (j in varVmGroups[i].Vm){
System.log(" VM Nr. " + j + " Name: " + varVmGroups[i].Vm[j].Name)
}
for (j in varVmGroups[i].Host){
System.log(" Host Nr. " + j + " Name: " + varVmGroups[i].Host[j].Name)
}
}
// Get all VM rules
var varVmRule = winEsxiCluster.configurationEx.rule;
System.log("")
System.log(" *** All Cluster Rules *** ")
System.log(" -------------------------- ")
for (i in varVmRule) {
System.log("");
System.log("Rule Nr.: " + i);
System.log(" Name: " + varVmRule[i].Name);
System.log(" Enabled: " + varVmRule[i].Enabled);
System.log(" Mandatory: " + varVmRule[i].Mandatory);
System.log(" VmGroup: " + varVmRule[i].VmGroupName);
System.log(" Affine hosts: " + varVmRule[i].AffineHostGroupName);
System.log(" Anti-Affiny: " + varVmRule[i].AntiAffineGroupName);
for (j in varVmRule[i].Vm){
System.log(" VM Nr. " + j + " Name: " + varVmRule[i].Vm[j].Name)
}
System.log(" VM Group: " + varVmRule[i].VmGroup);
System.log(" Depends on: " + varVmRule[i].DependsOnVmGroup);
}
This is the partially output, e.g. of all Groups:
2023-04-26 13:35:20.600 +02:00INFO *** All Cluster Groups ***
2023-04-26 13:35:20.601 +02:00INFO --------------------------
2023-04-26 13:35:20.602 +02:00INFO
2023-04-26 13:35:20.603 +02:00INFOGroup Nr.: 0
2023-04-26 13:35:20.604 +02:00INFOName: GO-Hosts
2023-04-26 13:35:20.605 +02:00INFO Host Nr. 0 Name: xxxxxxxxxxxxxxx
2023-04-26 13:35:20.606 +02:00INFO
2023-04-26 13:35:20.607 +02:00INFOGroup Nr.: 1
2023-04-26 13:35:20.608 +02:00INFOName: SG-Hosts
2023-04-26 13:35:20.609 +02:00INFO Host Nr. 0 Name: xxxxxxxxxxxxxxxx
2023-04-26 13:35:20.610 +02:00INFO
2023-04-26 13:35:20.611 +02:00INFOGroup Nr.: 2
2023-04-26 13:35:20.612 +02:00INFOName: NUMU_VMs
2023-04-26 13:35:20.613 +02:00INFO VM Nr. 0 Name: vax00222
2023-04-26 13:35:20.614 +02:00INFO VM Nr. 1 Name: vax00387
2023-04-26 13:35:20.615 +02:00INFO VM Nr. 2 Name: vax00262
2023-04-26 13:35:20.618 +02:00INFO VM Nr. 3 Name: vax00101
2023-04-26 13:35:20.619 +02:00INFO
2023-04-26 13:35:20.620 +02:00INFOGroup Nr.: 3
2023-04-26 13:35:20.621 +02:00INFOName: NOMO_VMs
2023-04-26 13:35:20.622 +02:00INFO VM Nr. 0 Name: vax00100
2023-04-26 13:35:20.623 +02:00INFO
But one information I cannot extract: the type of the group (VM or Host group?) or the type of the rule (VM to Host, Affinity, Anti-Affinity...?)
If I print all the output out, I can see that this information is at the start of the output. In this example, here one can see, the this muss be a AntiAffinityRule, because this information is three times mentioned as a substring in the first two lines:
2023-04-26 13:35:20.628 +02:00INFO DynamicWrapper (Instance) : [VcClusterAntiAffinityRuleSpec]-[class com.vmware.o11n.plugin.vsphere_gen.AntiAffinityRuleSpec_Wrapper] -- VALUE : (vim.cluster.AntiAffinityRuleSpec) {
dynamicType = null,
dynamicProperty = null,
key = 501,
status = null,
enabled = true,
name = Separate_VMs,
mandatory = null,
userCreated = true,
inCompliance = null,
ruleUuid = 52acd385-27a0-2220-a866-8ead2dd94aa0,
vm = (vim.VirtualMachine) [
Stub: moRef = (ManagedObjectReference: type = VirtualMachine, value = vm-15262, serverGuid = null), binding = https://xxxxxxxxxxxx:443/sdk,
Stub: moRef = (ManagedObjectReference: type = VirtualMachine, value = vm-15007, serverGuid = null), binding = https://xxxxxxxxxxxx:443/sdk
]
}
The same about the output of the groups...
But I cannot figure out, how I can read out this type information as a single property from a rule or a group?
Any tipps?
Regards
Roman