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 ServerGroup API from the Python nova-client.

Prerequisites

  • Verify that the intended anti-affinity 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. Create a new server group with an anti-affinity policy.
    POST /v2/TENANT_ID/os-server-groups
    
    {
        "server_group": {
            "name": "SERVER_GROUP_NAME",
            "policies": ["POLICY_TYPE"]
        }
    }

    Option

    Description

    TENANT_ID

    ID value for the OpenStack tenant.

    SERVER_GROUP_NAME

    Specify the name for the server group.

    POLICY_TYPE

    Specify either affinity or anti-affinity.

  2. Launch a new instance, including the os:scheduler_hints argument with the server group ID in the GET /servers command.
    ... "os:scheduler_hints": {"group": "SERVER_GROUP_UUID"}
  3. (Optional) : Confirm that the new rule and the server group instances appear and are running correctly in the VMware Integrated OpenStack deployment in vCenter.

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