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
- Using SSH, log in to the nova-client.
- (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.
- (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.
- Create a new server group with the intended policy.
- Create a server group with the affinity policy:
nova server-group-create --policy affinity <GROUP_NAME>
- Create a server group with the anti-affinity policy:
nova server-group-create --policy anti-affinity <GROUP_NAME>
In both case, the CLI returns the auto-generated server group UUID, name, and policy.
- 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
- (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 details appear in the page for the Compute cluster.