How to use affinity and anti‑affinity rules
Affinity and anti-affinity rules determine whether or not VMs are kept together as they are moved around within your environment.
- Affinity rules keep VMs together on the same host.
- Anti-affinity rules ensure that VMs are distributed across different hosts.
For example, if it is important that your application has very low latency, you can create affinity rules to make sure that the application's VMs are always kept on the same host. If you want your application to be robust in the event of host failures, you can create anti-affinity rules to spread the VMs across multiple hosts.
Creating an affinity or anti-affinity rule¤
To create an affinity or anti-affinity rule:
In VMware Cloud Director, click the VDC in which you want to create the affinity or anti-affinity rule.
In the left navigation panel, select Affinity Rules.
To create an affinity rule, in the Affinity Rules section, click New.
To create an anti-affinity rule,in the Anti-Affinity Rules section, click New.
In the Create Affinity Rule or Create Anti-Affinity Rule dialog box, enter a Name for the rule.
If you do not want the rule to take effect immediately, deselect the Enabled option. If you leave this option selected, the rule is applied and the selected VMs are redistributed as required as soon as you create the rule.
If you want the VMs added to the rule to be powered on if the rule cannot be met, deselect the Required option.
If you leave this option selected and if the rule cannot be met, the VMs added to the rule will not power on.
In the VMs in Rule section, select the VMs that you want to add to the rule.
When you're done, click Save.