summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yardstick/benchmark/contexts/model.py12
-rw-r--r--yardstick/cmd/commands/task.py12
2 files changed, 15 insertions, 9 deletions
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 2cf31f6ea..d31f4afc0 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -201,12 +201,12 @@ class Server(Object):
port_name,
network.router.stack_if_name,
self.secgroup_name)
- self.floating_ip_assoc["stack_name"] = \
- server_name + "-fip-assoc"
- template.add_floating_ip_association(
- self.floating_ip_assoc["stack_name"],
- self.floating_ip["stack_name"],
- port_name)
+ self.floating_ip_assoc["stack_name"] = \
+ server_name + "-fip-assoc"
+ template.add_floating_ip_association(
+ self.floating_ip_assoc["stack_name"],
+ self.floating_ip["stack_name"],
+ port_name)
template.add_server(server_name, self.image, self.flavor,
ports=port_name_list,
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index ca7c42897..b38e084ac 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -275,10 +275,16 @@ class TaskParser(object):
for cfg_attrs in context_cfgs:
context_type = cfg_attrs.get("type", "Heat")
if "Heat" == context_type and "networks" in cfg_attrs:
+ # bugfix: if there are more than one network,
+ # only add "external_network" on first one.
+ # the name of netwrok should follow this rule:
+ # test, test2, test3 ...
+ # sort network with the length of network's name
+ sorted_networks = sorted(cfg_attrs["networks"].keys())
# config external_network based on env var
- for _, attrs in cfg_attrs["networks"].items():
- attrs["external_network"] = os.environ.get(
- 'EXTERNAL_NETWORK', 'net04_ext')
+ cfg_attrs["networks"][sorted_networks[0]]["external_network"] \
+ = os.environ.get("EXTERNAL_NETWORK", "net04_ext")
+
context = Context.get(context_type)
context.init(cfg_attrs)