Make anti affinity working via server groups

Server groups is an openstack way to implement anti affinity. Anti affinity was implemented in Sahara before server groups were introduced in nova. Now it is time to replace custom solution with the common one.

Problem description

Direct engine uses manual scheduler hints for anti affinity.

Heat engine has limited anti affinity support and also uses scheduler hints (

Nova has generic mechanism for this purpose.

Proposed change

Proposed solution is to switch both engines to implementation that uses server groups.

Current server group implementation has limitation that each server could belong to a single server group only. We can handle this constraint by having one server group per cluster. In this case each instance with affected processes will be included to this server group. So, with such implementation there will be no several affected instances on the same host even if they don’t have common processes. Such implementation is fully compliant with all documentation we have about anti affinity.

We need to keep backward compatibility for direct engine. Users should be able to scale clusters deployed on Icehouse release. Sahara should update already spawned VMs accordingly. Proposed solution - Sahara should check server group existence during scaling and update whole cluster if server group is missing.

We don’t care about backward compatibility for heat engine. It was in beta state for Icehouse and there are other changes that break it.


We can implement anti affinity via server groups in heat engine only. We will stop support of direct engine somewhere in the future. So, we can freeze current behavior in direct engine and don’t change it until it is deprecated and removed.

Data model impact


REST API impact


Other end user impact

Anti affinity behavior changes in case of several involved processes. Before the change there was possible situation when several instances with affected (but different) processes are spawned on the same host. After the change all instances with affected processes will be scheduled to different hosts.

Deployer impact


Developer impact


Sahara-image-elements impact


Sahara-dashboard / Horizon impact




Primary assignee:


Work Items

Implement change




Will be covered by current integration tests.

Documentation Impact

Need note in upgrade notes about anti affinity behavior change.