Affinity and Anti-Affinity in Openstack

Hello friend. Sometime we need to create instances all on the same host. Or sometime we need to create instances on different hosts. How to do that? We can use affinity and anti-affinity feature.

First we need to create Server Group. Click on Project – Compute – Server Groups, then click ‘Create Server Group’ button.

Enter anything for the name – but I suggest a descriptive one. Choose the policy you want to use.

Available policies are:

  • Affinity: Restricts instances belonging to the server group to the same host.
  • Anti-affinity: Restricts instances belonging to the server group to separate hosts.
  • Soft-affinity: Attempts to restrict instances belonging to the server group to the same host. Where it is not possible to schedule all instances on one host, they will be scheduled together on as few hosts as possible.
  • Soft-anti-affinity: Attempts to restrict instances belonging to the server group to separate hosts. Where it is not possible to schedule all instances to separate hosts, they will be scheduled on as many separate hosts as possible.

When you launch instances, the created server group will be available at Server Groups section. Just choose a server group as your requirement and voila, your instances will be created on a same host or on several hosts.

Well, that’s all friend. I hope this post will be useful for you. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *