Configure VM-VM or VM-host affinity rules to define the relationships among VMs and the relationships between VMs and hosts.
VM-VM affinity rules include the following types:
Keep VMs Together—VMs of the rule must reside on the same host.
Separate VMs—VMs of the rule must reside on different hosts.
CVM supports configuration of the association action in VM-VM affinity rules. The action can be one of the following:
None.
Start—When a VM restricted by the affinity rule starts, all the other VMs restricted by the same affinity rule will be started at the same time.
Shut Down—When a VM restricted by the affinity rule shuts down, all the other VMs restricted by the same affinity rule will be shut down at the same time.
Start/Shut Down—When a VM restricted by the affinity rule starts or shuts down, all the other VMs restricted by the same affinity rule will be started or shut down at the same time.
VM-host affinity rules include the following types:
Must Run on Hosts in This Group—VMs in the VM group must run on hosts in the host group.
Should Run on Hosts in This Group—VMs in the VM group should (not must) run on hosts in the host group.
Must Run on Hosts in Other Groups—VMs in the VM group must not run on hosts in the host group.
Should Run on Hosts in Other Groups—VMs in the VM group should (not must) not run on hosts in the host group.
A VM-VM affinity rule for gathering VMs is applicable to service systems that have frequent data exchange and require VMs to run on the same host.
A VM-VM affinity rule for distributing VMs is applicable to environments that consume a large number of host resources, such as CPUs and memory. Distributing VMs to different hosts ensures load balancing in clusters.
Affinity rules might cause the failover host and DRS algorithms to be more complicated. Use affinity rules with caution.
Follow these restrictions and guidelines when you configure Separate VMs rules:
If the cluster is enabled with HA and HA access control and is configured with failover hosts:
Assume that the difference between the numbers of hosts and failover hosts in the cluster is n.
The maximum number of VMs that can be restricted by the affinity rule is n if n is larger than 2.
The maximum number of VMs that can be restricted by the affinity rule is 2 if n is smaller than or equal to 2.
If the cluster is not enabled with HA or is enabled with HA but not configured with failover hosts:
The maximum number of VMs that can be restricted by the affinity rule equals the number of hosts in the cluster if the number of hosts in the cluster is larger than 2.
The maximum number of VMs that can be restricted by the affinity rule is 2 if the number of hosts in the cluster is smaller than or equal to 2.
VMs restricted by VM-VM affinity rules must use shared storage.
You can add a VM to multiple non-conflicting VM-VM affinity rules, but cannot add a VM to both VM-VM and VM-host affinity rules. For example, you can configure a VM-VM affinity rule to require VM A and VM B to reside on the same host, and configure another VM-VM affinity rule to require VM A and VM C to reside on different hosts, but you can no longer add VM A to any VM-host affinity rules.
You cannot edit or delete VM-host affinity rules of the Should Run on Hosts in This Group type and with a name of "cluster name_VM-Host Affinity Rule in Local Region" or "cluster name_VM-Host Affinity Rule in Remote Region". The system changes the VMs or hosts in these rules accordingly when you add hosts to or remove hosts from the cluster local region or remote region and delete these rules when you disable stretched cluster configuration.
If a stretched cluster has been configured, you cannot add VM-host affinity rules of the Should Run on Hosts in This Group type and with a name of "cluster name_VM-Host Affinity Rule in Local Region" or "cluster name_VM-Host Affinity Rule in Remote Region".
From the left navigation pane, select Resources > Host Pool Name > Cluster Name.
Click More, and then select Affinity Rules.
On the page that opens, click Add.
Configure the parameters as described in "Parameters."
Click OK.
From the left navigation pane, select Resources > Host Pool Name > Cluster Name.
Click More, and then select Affinity Rules.
Configure the parameters as described in "Parameters."
Click OK.
From the left navigation pane, select Resources > Host Pool Name > Cluster Name.
Click More, and then select Affinity Rules.
In the dialog box that opens, click OK.
Name: Specify a name for the rule.
Type: Select an affinity rule type. Options include the following:
Keep VMs Together—VMs restricted by the affinity rule must reside on the same host.
Separate VMs—VMs restricted by the affinity rule must reside on different hosts.
VMs to Hosts—Configure a VM-host affinity rule.
Configure the following parameters if the rule type is Keep VMs Together or Separate VMs.
Related Action: Select the action to take on VMs restricted by the affinity rule.
VM List: Select the VMs to be restricted by the affinity rule.
Configure the following parameters if the rule type is VMs to Hosts.
VM Group: Select a VM group for the affinity rule.
Relationship: Select the relationship between VMs in the selected VM group and hosts in the selected host group.