Affinity and anti-affinity rules allow you to spread a group of virtual machines across different ESXi hosts or keep a group of virtual machines on a particular ESXi host.

An affinity rule places a group of virtual machines on a specific host so that you can easily audit the usage of those virtual machines. An anti-affinity rule places a group of virtual machines across different hosts, which prevents all virtual machines from failing at once in the event that a single host fails.

If the affinity or anti-affinity rules cannot be satisfied, this prevents the virtual machines added to the rule from powering on.

View VM Affinity and Anti-Affinity Rules in the VMware Cloud Director Tenant Portal

You can view existing affinity and anti-affinity rules and their properties, such as the virtual machines affected by the rules and whether the rules are enabled.

Procedure

  1. On the Virtual Data Center dashboard screen, click the card of the VDC you want to explore, and from the secondary left panel, select Affinity Rules.
  2. (Optional) Click the Grid editor icon (Grid Editor) and select what details about the rules you want to be displayed.

Results

You see the list of the existing affinity and anti-affinity rules, virtual machines, and enabled status of each rule.

Create a VM Affinity Rule in the VMware Cloud Director Tenant Portal

Create an affinity rule to place a specific group of virtual machines on a single host so that you can audit the usage of those virtual machines.

Procedure

  1. On the Virtual Data Center dashboard screen, click the card of the VDC you want to explore, and from the secondary left panel, select Affinity Rules.
  2. Under Affinity Rules, click New.
  3. Enter a name of the rule.
  4. Deselect Enabled to create the rule without enabling it.
    By default, the check box is selected and rules are enabled after you create them.
  5. Leave the Required check box selected.
    By default, each affinity rule is required. This means that if the rule cannot be satisfied, the virtual machines added to the rule do not power on.
  6. Select the virtual machines that you want to add to the affinity rule.
  7. Click Save.

Results

VMware Cloud Director places the virtual machines associated with the affinity rule on a single host.

Create a VM Anti-Affinity Rule in the VMware Cloud Director Tenant Portal

Create an anti-affinity rule to place a specific group of virtual machines across multiple hosts to prevent simultaneous failure of those virtual machines in the event that a single host fails.

Procedure

  1. On the Virtual Data Center dashboard screen, click the card of the VDC you want to explore, and from the secondary left panel, select Affinity Rules.
  2. Under Anti-Affinity Rules, click New.
  3. Enter a name of the rule.
  4. Deselect Enabled to create the rule without enabling it.
    By default, the check box is selected and rules are enabled after you create them.
  5. Leave the Required check box selected.
    By default, each anti-affinity rule is required. This means that if the rule cannot be satisfied, the virtual machines added to the rule do not power on.
  6. Select the virtual machines to add to the anti-affinity rule.
  7. Click Save.

Results

VMware Cloud Director places the virtual machines associated with the anti-affinity rule across multiple hosts.

Edit a VM Affinity or Anti-Affinity Rule in the VMware Cloud Director Tenant Portal

You can edit an affinity or anti-affinity rule to activate or deactivate the rule, add or remove virtual machines, change the rule name or the rule preference.

Prerequisites

Verify that you have the Organization vDC: VM-VM Affinity Edit right. This right is included in the predefined Catalog Author, vApp Author, and Organization Administrator roles.

Procedure

  1. On the Virtual Data Center dashboard screen, click the card of the VDC you want to explore, and from the secondary left panel, select Affinity Rules.
  2. Click the radio button next to the name of the rule that you want to edit and click Edit.
  3. Edit the rule properties.
    1. Change the name of the rule as necessary.
    2. Select whether to activate or deactivate the rule.
    3. Leave the Required check box selected.
    4. Add more virtual machines or remove virtual machines.
  4. Click Save.

Delete an Affinity or Anti-Affinity Rule in the VMware Cloud Director Tenant Portal

If you no longer want to use an affinity or anti affinity rule, you can delete it.

Procedure

  1. On the Virtual Data Center dashboard screen, click the card of the VDC you want to explore, and from the secondary left panel, select Affinity Rules.
  2. Click the radio button next to the name of the rule that you want to delete and click Delete.
  3. To confirm that you want to delete the rule, click OK.

Results

VMware Cloud Director deletes the affinity or anti-affinity rule.