6.11. Affinity Groups
Virtual machine affinity allows you to define sets of rules that specify whether certain virtual machines run together on the same host or hosts in a group, or run separately on different hosts. This allows you to create advanced workload scenarios for addressing challenges such as strict licensing requirements, workloads demanding high availability, and failover and failback for disaster recovery.
Virtual machine affinity is applied to virtual machines by adding virtual machines to one or more affinity groups. An affinity group is a group of two or more virtual machines for which a set of identical parameters and conditions apply. These parameters include positive (run together) affinity that ensures the virtual machines in an affinity group run on the same host or hosts in a group, and negative (run independently) affinity that ensures the virtual machines in an affinity group run on different hosts.
Important
Affinity groups will only take effect when the
VmAffinityGroups
or VmToHostsAffinityGroups
filter module or weights module is enabled in the scheduling policy applied to clusters in which affinity groups are defined. The two modules are complementary and can be used together. For more information about scheduling policies see Scheduling Policies in the Administration Guide.
A further set of conditions can then be applied to these parameters in the associated scheduling policy.
- Hard enforcement - ensures that virtual machines in the affinity group run on a specified host or hosts in a group regardless of external conditions. The filter modules in the scheduling policy implement hard enforcement.
- Soft enforcement - indicates a preference for virtual machines in an affinity group to run on the specified host or hosts in a group when possible. The the weights modules in the scheduling policy implement soft enforcement.
The combination of an affinity group, its parameters, and its conditions is known as an affinity policy. Affinity policies are applied to running virtual machines immediately, without having to restart.
Note
Affinity groups are applied to virtual machines on the cluster level. When a virtual machine is moved from one cluster to another, that virtual machine is removed from all affinity groups in the source cluster.
6.11.1. Creating an Affinity Group
You can create new affinity groups in the Administration Portal.
Procedure 6.18. Creating Affinity Groups
- Click the Virtual Machines tab and select a virtual machine.
- Click the Affinity Groups tab in the details pane.
- Click.
- Enter a Name and Description for the affinity group.
- From the VM Affinity Rule drop-down, select Positive to apply positive affinity or Negative to apply negative affinity. Select Disable to disable the affinity rule.
- Select the Enforcing check box to apply hard enforcement, or ensure this check box is cleared to apply soft enforcement.
- Use the drop-down list to select the virtual machines to be added to the affinity group. Use theand buttons to add or remove additional virtual machines.
- Click.
6.11.2. Editing an Affinity Group
Procedure 6.19. Editing Affinity Groups
- Click the Virtual Machines tab and select a virtual machine.
- Click the Affinity Groups tab in the details pane.
- Click.
- Change the VM Affinity Rule drop-down and Enforcing check box to the preferred values and use the and buttons to add or remove virtual machines to or from the affinity group.
- Click.
6.11.3. Removing an Affinity Group
Procedure 6.20. Removing Affinity Groups
- Click the Virtual Machines tab and select a virtual machine.
- Click the Affinity Groups tab in the details pane.
- Click.
- Click.
The affinity policy that applied to the virtual machines that were members of that affinity group no longer applies.