summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-23 17:23:07 +0000
committerGerrit Code Review <review@openstack.org>2018-08-23 17:23:07 +0000
commit08e8b51eafe2b324abf3889e778846de81a61cdd (patch)
tree2d17a6206f372dbfb38e77dae485b85dd4745c85
parentf8566f6daf18b29be8bc44ec1ce5e9dd16c87ef3 (diff)
parent4ac73ea6ecb001e7973a563a04b25ab914f79f21 (diff)
Merge "Fixing anti-affinity for Sahara"
-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: