If you create a DRS affinity rule for your cluster, you can specify how vSphere HA applies that rule during a virtual machine failover.
Note: This topic describes using affinity rules for DRS. You can also use affinity rules without DRS.
The two types of rules for which you can specify vSphere HA failover behavior are the following:
- VM anti-affinity rules force specified virtual machines to remain apart during failover actions.
- VM-Host affinity rules place specified virtual machines on a particular host or a member of a defined group of hosts during failover actions.
When you edit a DRS affinity rule, you must use vSphere HA advanced options to enforce the desired failover behavior for vSphere HA.
- HA must respect VM anti-affinity rules during failover -- When the advanced option for VM anti-affinity rules is set, vSphere HA does not fail over a virtual machine if doing so violates a rule. Instead, vSphere HA issues an event reporting there are insufficient resources to perform the failover.
- HA should respect VM to Host affinity rules during failover --vSphere HA attempts to place VMs with this rule on the specified hosts if at all possible.
For more information, see vSphere HA Advanced Options.
Note: vSphere HA can restart a VM in a DRS-deactivated cluster, overriding a VM-Host affinity rules mapping if the host failure happens soon (by default, within 5 minutes) after setting the rule.