<div dir="ltr">Hello,<div><br></div><div>I was unable to get anti-affinity to work in Sahara. The logs were reporting a Heat error that u'' was not a valid UUID. Upon further investigation, I think I found several errors in the `sahara/service/heat/templates.py` file. I'm working with Sahara 7.0.0 but the master branch still exhibits these problems.</div><div><br></div><div>I figured I would start with posting to the general openstack list rather than -dev or opening a bug report just to check my sanity on this. If these findings are correct, then anti-affinity is broke and has been for some time. The alternative is that I've missed some configuration somewhere -- which is entirely possible :)</div><div><br></div><div>1. ng.count is either invalid, always returns 0, or isn't being set somewhere else.</div><div><br></div><div><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></div><div><br></div><div>Instead, I've used </div><div><br></div><div>ng_count = self.node_groups_extra[<a href="http://ng.id">ng.id</a>]['node_count']<br></div><div><br></div><div>2. an uninitialized Python key.<br></div><div><br></div><div><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></div><div><br></div><div>3. Incorrect bounds in range():</div><div><br></div><div><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></div><div><br></div><div>I believe this should be:</div><div><br></div><div>for i in range(0, self.cluster.anti_affinity_ratio):<br></div><div>    resources.update(self._serialize_aa_server_group(i+1))</div><div><br></div><div><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></div><div><br></div><div>I believe this should be:</div><div><br></div><div>for i in range(0, ng_count):<br></div><div><br></div><div>Thanks,</div><div>Joe</div><div><br></div><div><br></div></div>