One of the hot new features in vSphere 5 was the introduction of SDRS. And with SDRS came the concept of affinity rules for VMs and VMDKs. Cormac, aka @VMwareStorage, posted a nice overview of the SDRS affinity rules in Storage DRS Affinity & Anti-Affinity Rules.
Since then several posts have appeared on the subject of SDRS affinity rules. To list just a few:
- Frank Denneman: Impact of Intra VM affinity rules on Storage DRS. This post contains Alan Renouf‘s function Set-DatastoreClusterDefaultIntraVmAffinity which allows you to configure the default intra-VM affinity rule on a DatastoreCluster.
- Frank Denneman: (Storage) DRS (anti-) affinity rule types and HA interoperability
- Duncan Epping: Setting the default affinity rule for Storage DRS
Currently there are no PowerCLI cmdlets to define the inter- and intra-vm anti-affinity rules for SDRS. After a question in the VMTN PowerCLI Community I decided to write a function. This function will allow you to automate the creation of the SDRS anti-affinity rules.