Create a Server Group

 

Server groups can be used to ensure that instances are either placed on the same hypervisor (affinity) or are placed on different hypervisors (anti-affinity).

There are four policies which can be applied to a server group:

affinity

soft-affinity

anti-affinity

soft-anti-affinity

Server groups can be implemented in a Heat template using the resource OS::Nova::ServerGroup.

Syntax

resource: server_group: type: OS::Nova:ServerGroup properties: name: string #Optional, - Server group name. Any updates cause replacement. policies: [string, string] #Optional, a list of string policies to apply.

Example

resources: affinity_group: type: OS::Nova::ServerGroup properties: name: hosts on same compute nodes policies: - affinity my_instance: type: OS::Nova::Server properties: image: { get_param: image_id } flavor: { get_param: flavor_id } key_name: {get_param: KeyName } networks: - network: Internal #define the network to use as internal security_groups: - { get_param: security_group_id } user_data_format: RAW name: server_1 #name for instance scheduler_hints: group: {get_resource: affinity_group}

You can list the server groups which are in your project using the command:

openstack server group list

This should return a table similar to this one:

You can also list the members of the server group using:

For example:

 

References