You can place instances using OpenStack server groups with an affinity or anti-affinity policy. Affinity indicates that all instances in the group must placed on the same host, and anti-affinity indicates that no instances in the group can be placed on the same host.

Affinity and anti-affinity policies cannot determine the specific ESXi host on which instances are placed. These policies only control whether instances are placed on the same hosts as other instances in a server group. To place instances on specific hosts, see Use DRS to Control OpenStack Instance Placement.


Verify that the intended filter configuration does not conflict with any existing administrative configuration, such as DRS rules that manage instance placement on hosts.


  1. Log in to the OpenStack Management Server as viouser.
  2. Switch to the root user and load the cloud administrator credentials file.
    sudo su -
    source ~/cloudadmin.rc
  3. Create a server group with the desired policy.
    openstack server group create group-name --policy {affinity | anti-affinity}




    Enter a name for the server group.


    Enter affinity to place instances on the same host or anti-affinity to prevent instances from being placed on the same host.

  4. When you launch an instance, pass the server group as a scheduler hint to implement affinity or anti-affinity.
    openstack server create instance-name --image image-uuid --flavor flavor-name --nic net-id=network-uuid --hint group=servergroup-uuid

What to do next

Confirm that the affinity rules and instances are configured correctly. In vCenter Server, select the compute cluster, open the Configure tab, and click VM/Host Rules.