Hi All,
Has anyone of you ever checked the vCenter SDK for how to create a Storage DRS Anti-Affinity Rule for a specific VM?
Below is the code for how to add VM's to a VcCluster compute Anti Affinity Rule. But is there a lookalike code for a Storage DRS Anti-Affinity Rule?
//Set rule spec attributes |
affinitySpec = new VcClusterAntiAffinityRuleSpec();
affinitySpec.enabled = true;
affinitySpec.name = group_name;
affinitySpec.userCreated = true;
affinitySpec.vm = vms;
//Apply RuleSpec
var clusterRuleSpec = new Array(new VcClusterRuleSpec());
clusterRuleSpec[0] = new VcClusterRuleSpec() | |
clusterRuleSpec[0].operation = VcArrayUpdateOperation.add; | |
clusterRuleSpec[0].info = affinitySpec; |
var clusterConfigSpec = new VcClusterConfigSpecEx();
clusterConfigSpec.rulesSpec = clusterRuleSpec; |
task = cluster.reconfigureComputeResource_Task(clusterConfigSpec, true);
Thanks upfront for comments!