VM-VM anti-affinity policies are crucial for ensuring high availability and fault tolerance by preventing certain VMs from running on the same physical host. This guide will walk you through configuring a VM-VM anti-affinity policy in Nutanix, from creating the anti-affinity group to verifying its configuration.
1. Create the Anti-Affinity Group
First, you need to create an anti-affinity group where the VMs will be managed to ensure they are not colocated on the same host.
acli vm_group.create MyGroupName-Anti-Affinity
2. Add VMs to the Anti-Affinity Group
Next, add the VMs to the anti-affinity group. You can add multiple VMs to the group to enforce the anti-affinity rule across all specified VMs.
acli vm_group.add_vms MyGroupName-Anti-Affinity vm_list=VM1
acli vm_group.add_vms MyGroupName-Anti-Affinity vm_list=VM2
3. Activate the Anti-Affinity Group
Once the VMs are added, you need to activate the anti-affinity group. This is done with a soft activation, which indicates that Nutanix will attempt to place the VMs on different hosts, but it’s not strictly enforced.
acli vm_group.antiaffinity_set MyGroupName-Anti-Affinity
4. Verify and Check the Members of the Anti-Affinity Group
To ensure that the anti-affinity policy is correctly configured and to verify the members of the group, use the following commands:
acli vm_group.get MyGroupName-Anti-Affinity
List the VMs in the Anti-Affinity Group
acli vm_group.list_vms MyGroupName-Anti-Affinity