OpenStack – How to Have Node Affinity in OpenStack?

affinityopenstackopenstack-nova

For Example, I have 3 Compute servers and I want to have 1 Specific Instance on each of them and I want to have Node Affinity on them.

  • instance_1 –> compute_node_1 (Always on this node)
  • instance_2 –> compute_node_2 (Always on this node)
  • instance_3 –> compute_node_3 (Always on this node)

I know there is a "Senlin" service. But how to use it exactly? Or if there is another solution?

Best Answer

You don't need Senlin. You can create a server group with an anti-affinity policy (i.e. a policy that spreads servers over compute nodes), then launch your instances in that group.

The Nova-Scheduler anti-affinity filter must be enabled. Note that there is no guarantee that instances are scheduled in the desired way; for example, if a compute node has no capacity left, it won't be used.

See https://docs.openstack.org/nova/victoria/admin/configuration/schedulers.html#servergroupantiaffinityfilter for details.

There is another option: In one of the recent Nova releases (Xena, Wallaby or Victoria), it has become possible for an admin to ask for a specific compute node when launching an instance. Please see the release notes for more detail.

Related Topic