A VM-VM affinity policy describes a relationship between members of a category of VMs.

VM-VM affinity policies can be useful when two or more VMs in a category can benefit from locality of data reference or where placement on the same host can simplify auditing.

A VM-VM affinity policy establishes an affinity relationship between virtual machines in a given category. After the policy is created, the placement engine in your SDDC attempts to deploy all VMs in the category covered by the policy on the same host.

Prerequisites

This operation is restricted to users who have the CloudAdmin role.

Procedure

  1. Create a category and tag for each group of VMs that you want to include in a VM-VM affinity policy.

    You can use existing tags and categories or create new ones specific to your needs. See vSphere Tags and Attributes for more about creating and using tags.

  2. Tag the VMs that you want to include in each group.
  3. Create a VM-VM affinity policy.
    1. In your SDDC, click OPEN VCENTER.
    2. From the vSphere Client, click Policies and Profiles > Compute Policies.
    3. Click Add to open the New Compute Policy Wizard
    4. Fill in the policy Name and choose VM-VM affinity from the Policy type drop-down control.
      The policy Name must be unique within your SDDC.
    5. Provide a Description of the policy, then use the VM tag drop-down control to choose the Category and Tag to which the policy applies.
      Unless you have multiple VM tags associated with a category, the wizard fills in the VM tag after you select the tag Category.
    6. Click Create to create the policy.
  4. (Optional) To delete a compute policy, open the vSphere Client, click Policies and Profiles > Compute Policies to show each policy as a card. Click DELETE on the policy card to delete the policy.