Skip to content

Commit 8fc8925

Browse files
Non-strict affinity groups: update doc and add examples (#291)
1 parent 42e243d commit 8fc8925

1 file changed

Lines changed: 57 additions & 11 deletions

File tree

source/adminguide/virtual_machines.rst

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,17 +613,23 @@ Affinity Groups
613613

614614
By defining affinity groups and assigning VMs to them, the user or
615615
administrator can influence (but not dictate) which VMs should run on
616-
either the same or separate hosts. This feature is to let users specify
616+
either the same or separate hosts. This feature allows users to specify
617617
the affinity groups to which a VM can belong. VMs with the
618-
same “host anti-affinity” type won’t be on the same host. This serves to
618+
same “host anti-affinity” type won’t be on the same host, which serves to
619619
increase fault tolerance. If a host fails, another VM offering the same
620620
service (for example, hosting the user's website) is still up and
621621
running on another host.
622-
It also lets the user specify that VMs with the same "host affinity" type
623-
run on the same host. This can be useful in ensuring connectivity and minimum
624-
latency in between guest VMs.
622+
It also allows users to specify that VMs with the same "host affinity" type
623+
must run on the same host, which can be useful in ensuring connectivity and low
624+
latency between guest VMs.
625+
"non-strict host anti-affinity" is similar to, but more flexible than, "host
626+
anti-affinity". In that case VMs are deployed to different hosts as long as
627+
there are enough hosts to satisfy the requirement, otherwise they might be
628+
deployed to the same host.
629+
"non-strict host affinity" is similar to, but more flexible than, "host affinity",
630+
VMs are ideally placed together in the same host, but only if possible.
625631

626-
The scope of an affinity group is per user account.
632+
The scope of an affinity group is on an account level.
627633

628634

629635
Creating a New Affinity Group
@@ -643,11 +649,16 @@ To add an affinity group:
643649
- Description. Any desired text to tell more about the purpose of
644650
the group.
645651

646-
- Type. CloudStack supports two types of affinity groups. "Host
647-
Anti-Affinity" and "Host Affinity". "Host Anti-Affinity" indicates
648-
that the VMs in this group should avoid being placed on the same
649-
host with each other. "Host Affinity" on the other hand indicates
650-
that VMs in this group should be placed on the same host.
652+
- Type. CloudStack supports four types of affinity groups. "host
653+
anti-affinity", "host affinity", "non-strict host affinity" and
654+
"non-strict host anti-affinity". "host anti-affinity" indicates
655+
that the VMs in this group must not be placed on the same
656+
host with each other. "host affinity" on the other hand indicates
657+
that VMs in this group must be placed on the same host.
658+
"non-strict host anti-affinity" indicates that VMs in this group
659+
should be deployed to different hosts.
660+
"non-strict host affinity" indicates that VMs in this group
661+
shouldn’t be deployed to same hosts.
651662

652663

653664
Assign a New VM to an Affinity Group
@@ -710,6 +721,41 @@ To delete an affinity group:
710721
group.
711722

712723

724+
Determine Destination Host of VMs with Non-Strict Affinity Groups
725+
''''''''''''''''''''''''
726+
727+
(Non-Strict Host Anti-Affinity and Non-Strict Host Affinity only)
728+
729+
The destination host of VMs with Non-Strict Affinity Groups are determined
730+
by the host priorities. The hosts have default priority as 0. If there is a
731+
VM in the same Non-Strict Host Anti-Affinity group on the host, the host
732+
priority will be decreased by 1. If there is a VM in the same Non-Strict Host
733+
Affinity group on the host, the host priority will be increased by 1. All
734+
available hosts are reordered by host priorities when deploy or start a VM.
735+
736+
Here are some examples how host priorities are calculated.
737+
738+
- Example 1: VM has a non-strict host anti-affinity group.
739+
740+
If Host-1 has 2 VMs in the group, Host-2 has 3 VMs in the group.
741+
Host-1 priority is -2, Host-2 priority is -3. If there are only 2 hosts,
742+
VM will be deployed to Host-1 as it has higher priority (-2 > -3).
743+
744+
- Example 2: VM has a non-strict host affinity group.
745+
746+
If Host-1 has 2 VMs in the group, Host-2 has 3 VMs in the group.
747+
Host-1 priority is 2, Host-2 priority is 3. If there are only 2 hosts,
748+
VM will be deployed to Host-2 (3 >2).
749+
750+
- Example 3: VM has a non-strict host affinity group and also a non-strict host anti-affinity group.
751+
752+
If Host-1 has 2 VMs in the non-strict host affinity group, and
753+
3 VMs in the non-strict host anti-affinity group. Host-1 priority is
754+
calculated by:
755+
756+
0 (default) + 2 (VMs in non-strict host affinity group) - 3 (VMs in the non-strict host anti-affinity group) = -1
757+
758+
713759
Changing a VM's Base Image
714760
--------------------------
715761

0 commit comments

Comments
 (0)