Browse Source

Merge "Fixing anti-affinity for Sahara"

tags/10.0.0.0b1
Zuul 10 months ago
parent
commit
08e8b51eaf
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      sahara/service/heat/templates.py

+ 7
- 4
sahara/service/heat/templates.py View File

@@ -253,8 +253,8 @@ class ClusterStack(object):
253 253
 
254 254
         if self.cluster.anti_affinity:
255 255
             # Creating server groups equal to the anti_affinity_ratio
256
-            for i in range(1, self.cluster.anti_affinity_ratio):
257
-                resources.update(self._serialize_aa_server_group(i))
256
+            for i in range(0, self.cluster.anti_affinity_ratio):
257
+                resources.update(self._serialize_aa_server_group(i + 1))
258 258
 
259 259
         for ng in self.cluster.node_groups:
260 260
             resources.update(self._serialize_ng_group(ng, outputs,
@@ -274,13 +274,16 @@ class ClusterStack(object):
274 274
         properties = {"instance_index": "%index%"}
275 275
 
276 276
         if ng.cluster.anti_affinity:
277
-            ng_count = ng.count
277
+            ng_count = self.node_groups_extra[ng.id]['node_count']
278 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 280
                 server_group_name = self._get_server_group_name()
281 281
                 server_group_resource = {
282 282
                     "get_resource": server_group_name
283 283
                 }
284
+                if SERVER_GROUP_NAMES not in properties:
285
+                    properties[SERVER_GROUP_NAMES] = []
286
+
284 287
                 properties[SERVER_GROUP_NAMES].insert(i, server_group_resource)
285 288
 
286 289
         if ng.auto_security_group:

Loading…
Cancel
Save