anti-affinity in openstack kilo doesn't work

asked 2015-12-02 05:22:16 -0500

alexyang2018 gravatar image

We are using openstack kilo in our project and we need to have anti-affinity enabled.

The expected behavior is that 2 instances of the same images shold be installed to 2 different hosts once the anti-affinity is enabled.

I used the sample configuration taken from the guide for anti-affinity in Openstack. However, I got an error stating that the heat template is not valid when loading the heat template.

If I don't add policy_group at all but just have servergroup filters(both affinity and anti-affinity) enabled in nova config, the anti-affinity works correctly in most cases.But in some cases, the 2 instances of 1 image are installed to the same host like the behaviour when the affinity is enabled.

My question is as below: 1.Is the sample configuration correct for anti-affinity support?If not, what shold be the correct configuration?

Sample configuration with policy_group:

resources:
  policy_group:
    type: OS::Nova::ServerGroup
    properties:
    name: nova-server-group
    policies: [anti-affinity]
 os:
    type: OS::Nova::Server
    properties:
       key_name: {get_param: key}
       image: {get_param: image}
       flavor: {get_param: flavor}
       scheduler_hints: {group: {get_resource: policy_group}}

Sample configuration without policy_group:

 os:
    type: OS::Nova::Server
    properties:
       key_name: {get_param: key}
       image: {get_param: image}
       flavor: {get_param: flavor}
edit retag flag offensive close merge delete