VMware Cloud Community
Merijndk
Contributor
Contributor

Storage DRS Anti-Affinity Rules by set Orchestrator workflow/action

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!

0 Kudos
1 Reply
mhampto
VMware Employee
VMware Employee

Only seeing references to this in vRealize Orchestrator 7.0 Documentation Center

Not seeing a SDK command for it at this time.

0 Kudos