You can place instances using affinity or anti-affinity by creating a server group in OpenStack and applying desired filter as a group policy. All instances that are members of the server group will be subject to the affinity or anti-affinity policy. You can perform this configuration using the CLI.

Prerequisites

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

  • Verify that you are running VMware Integrated OpenStack version 2.0.x or later.

  • Verify that VMware Integrated OpenStack is running.

  • Verify that you are using a Python nova-client version 2.17.0.6 or later as required for the ServerGroup API. Go to http://docs.openstack.org/user-guide/common/cli_install_openstack_command_line_clients.html.

Procedure

  1. Using SSH, log in to the nova-client.
  2. (Optional) : Obtain the ID of the image you will use to create the instance.

    You can use the nova image-list command to view the list of available images and their ID values.

  3. (Optional) : Obtain the ID of the flavor you will use to define the instance .

    You can use the nova flavor-list command to view the list of flavor definitions and their ID values.

  4. Create a new server group with the intended policy.
    1. Create a server group with the affinity policy:
      nova server-group-create GROUP_NAME affinity 
    2. Create a server group with the anti-affinity policy:
      nova server-group-create GROUP_NAME anti-affinity

    In both case, the CLI returns the auto-generated server group UUID, name, and policy.

  5. Launch a new instance, using the --image, --flavor, and --hint flags to apply the server group affinity policy .
    nova boot --image IMAGE_ID --flavor FLAVOR_ID --hint group=SERVER_GROUP_UUID INSTANCE_NAME
  6. (Optional) : Confirm that the new rule and the server group instances appear and are running correctly in the VMware Integrated OpenStack deployment in vCenter Server.

    The details appear in the Manage > Settings > VM/Host Rules page for the Compute cluster.