<div dir="ltr"><div>Hello,</div><div><br></div><div>I originally posted this to the general openstack list to get a sanity check on what I was seeing. Jeremy F reached out and confirmed that, so I'm going to re-post the details here to begin a discussion.</div><div><br></div><div>From what I can see, anti-affinity is not working at all in Sahara. I was able to get it working locally by making the following changes:</div><div><br></div><div>1. ng.count is either invalid, always returns 0, or isn't being set somewhere else.<br><br><a href="https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L276">https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L276</a><br><br>Instead, I've used <br><br>ng_count = self.node_groups_extra[<a href="http://ng.id">ng.id</a>]['node_count']<br><br>2. An uninitialized Python key:<br><br><a href="https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L283">https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L283</a><br><br>3. Incorrect bounds in range():<br><br><a href="https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L255-L256">https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L255-L256</a><br><br>I believe this should be:<br><br>for i in range(0, self.cluster.anti_affinity_ratio):<br>    resources.update(self._serialize_aa_server_group(i+1))<br><br><a href="https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L278">https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L278</a><br><br>I believe this should be:<br><br>for i in range(0, ng_count):</div><div><br></div><div>With the above in place, anti-affinity began working. The above changes were all quick fixes to get it up and running, so there might be better ways of going about this.</div><div><br></div><div>I can also create something on StoryBoard for this, too.<br></div><div><br></div><div>Thanks,</div><div>Joe<br></div></div>