summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTelles Nobrega <tenobreg@redhat.com>2018-08-01 15:52:55 -0300
committerJeremy Freudberg <jeremyfreudberg@gmail.com>2018-08-23 14:48:26 +0000
commit4ac73ea6ecb001e7973a563a04b25ab914f79f21 (patch)
tree1dc0fc73da0603fea30d4479dcf03be4f1862ff5
parent76549404c4d79a779774d1e64c1a113002e29c19 (diff)
Fixing anti-affinity for Sahara
Sahara anti-affinity was broken since some problematic changes in cd1569852614698c4843d4c97475d8f8f3069478. This should be able to fix it. Change-Id: I374c0340cb0f85c00b9a04cd1b23e3912737994c Co-Authored-By: Joe Topjian <joe@topjian.net> Story: #2002656 Task: #22466
Notes
Notes (review): Code-Review+2: Jeremy Freudberg <jeremyfreudberg@gmail.com> Code-Review+2: Luigi Toscano <ltoscano@redhat.com> Workflow+1: Luigi Toscano <ltoscano@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 23 Aug 2018 17:23:07 +0000 Reviewed-on: https://review.openstack.org/587978 Project: openstack/sahara Branch: refs/heads/master
-rw-r--r--sahara/service/heat/templates.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/sahara/service/heat/templates.py b/sahara/service/heat/templates.py
index 1901bbf..44e60b0 100644
--- a/sahara/service/heat/templates.py
+++ b/sahara/service/heat/templates.py
@@ -253,8 +253,8 @@ class ClusterStack(object):
253 253
254 if self.cluster.anti_affinity: 254 if self.cluster.anti_affinity:
255 # Creating server groups equal to the anti_affinity_ratio 255 # Creating server groups equal to the anti_affinity_ratio
256 for i in range(1, self.cluster.anti_affinity_ratio): 256 for i in range(0, self.cluster.anti_affinity_ratio):
257 resources.update(self._serialize_aa_server_group(i)) 257 resources.update(self._serialize_aa_server_group(i + 1))
258 258
259 for ng in self.cluster.node_groups: 259 for ng in self.cluster.node_groups:
260 resources.update(self._serialize_ng_group(ng, outputs, 260 resources.update(self._serialize_ng_group(ng, outputs,
@@ -274,13 +274,16 @@ class ClusterStack(object):
274 properties = {"instance_index": "%index%"} 274 properties = {"instance_index": "%index%"}
275 275
276 if ng.cluster.anti_affinity: 276 if ng.cluster.anti_affinity:
277 ng_count = ng.count 277 ng_count = self.node_groups_extra[ng.id]['node_count']
278 # assuming instance_index also start from index 0 278 # assuming instance_index also start from index 0
279 for i in range(0, ng_count - 1): 279 for i in range(0, ng_count):
280 server_group_name = self._get_server_group_name() 280 server_group_name = self._get_server_group_name()
281 server_group_resource = { 281 server_group_resource = {
282 "get_resource": server_group_name 282 "get_resource": server_group_name
283 } 283 }
284 if SERVER_GROUP_NAMES not in properties:
285 properties[SERVER_GROUP_NAMES] = []
286
284 properties[SERVER_GROUP_NAMES].insert(i, server_group_resource) 287 properties[SERVER_GROUP_NAMES].insert(i, server_group_resource)
285 288
286 if ng.auto_security_group: 289 if ng.auto_security_group: