From 8bb02c59547badff1a7a2e2ab4a9f3622a0134d1 Mon Sep 17 00:00:00 2001 From: QiLiang Date: Tue, 12 Jan 2016 20:10:40 +0000 Subject: Workround for openstack nova bug Notes: if placement_groups policy is "availability" and > 2 servers in this group may still have this issue. JIRA: YARDSTICK-200 Signed-off-by: QiLiang (cherry picked from commit 10e55c026879912a36247f8958c954cb7521f9e5) Change-Id: I4b56ea63fc1adae6985c0d5101359299839cd86c --- yardstick/benchmark/contexts/heat.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index 7bd430bc5..8c514d250 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -129,8 +129,27 @@ class HeatContext(Context): scheduler_hints = {} for pg in server.placement_groups: update_scheduler_hints(scheduler_hints, added_servers, pg) - server.add_to_template(template, self.networks, scheduler_hints) - added_servers.append(server.stack_name) + # workround for openstack nova bug, check JIRA: YARDSTICK-200 + # for details + if len(availability_servers) == 2: + if len(scheduler_hints["different_host"]) == 0: + scheduler_hints.pop("different_host", None) + server.add_to_template(template, + self.networks, + scheduler_hints) + added_servers.append(server.stack_name) + else: + scheduler_hints["different_host"] = \ + scheduler_hints["different_host"][0] + server.add_to_template(template, + self.networks, + scheduler_hints) + added_servers.append(server.stack_name) + else: + server.add_to_template(template, + self.networks, + scheduler_hints) + added_servers.append(server.stack_name) # create list of servers with affinity policy affinity_servers = [] -- cgit 1.2.3-korg