Mailing List Archive

[Sahara] Anti-Affinity Broke?
Hello,

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.

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 :)

1. ng.count is either invalid, always returns 0, or isn't being set
somewhere else.

https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L276

Instead, I've used

ng_count = self.node_groups_extra[ng.id]['node_count']

2. an uninitialized Python key.

https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L283

3. Incorrect bounds in range():

https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L255-L256

I believe this should be:

for i in range(0, self.cluster.anti_affinity_ratio):
resources.update(self._serialize_aa_server_group(i+1))

https://github.com/openstack/sahara/blob/master/sahara/service/heat/templates.py#L278

I believe this should be:

for i in range(0, ng_count):

Thanks,
Joe