aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/contexts/heat.py
diff options
context:
space:
mode:
authorDanielMartinBuckley <daniel.m.buckley@intel.com>2017-04-05 11:20:46 +0100
committerRoss Brattain <ross.b.brattain@intel.com>2017-05-12 21:01:54 +0000
commitd002db9a10fed7cdba2cc43a8c064864250994ce (patch)
tree5cda13ea59ad732c2cd047ebfb0468e6ee425aef /yardstick/benchmark/contexts/heat.py
parent344921452e405189b8b5ec0697bf5d1ca88eb8ed (diff)
Create flavor from heat context
JIRA: YARDSTICK-582 Create a customizable flavor via heat context. All heat parameters are configurable including Core Affinity. The default flavor name is XXXX-flavor where XXXX is stackname. Flavor attributes are taken from the heat context file. If a flavor attribute is not used it takes default attribute value. If flavor name is not specified it uses the server name + "-flavor" or stack-name + "-flavor". Compute node specific attributes are configurable via "extra_specs" attribute. See https://docs.openstack.org/admin-guide/compute-flavors.html for details. Change-Id: If4015970b889b0b95bfa8eba9491ebf31e92f2c7 Signed-off-by: DanielMartinBuckley <daniel.m.buckley@intel.com>
Diffstat (limited to 'yardstick/benchmark/contexts/heat.py')
-rw-r--r--yardstick/benchmark/contexts/heat.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index d5dccd2a2..b689ac09c 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -47,6 +47,7 @@ class HeatContext(Context):
self._server_map = {}
self._image = None
self._flavor = None
+ self.flavors = set()
self._user = None
self.template_file = None
self.heat_parameters = None
@@ -129,6 +130,13 @@ class HeatContext(Context):
def _add_resources_to_template(self, template):
"""add to the template the resources represented by this context"""
+
+ if self.flavor:
+ if isinstance(self.flavor, dict):
+ flavor = self.flavor.setdefault("name", self.name + "-flavor")
+ template.add_flavor(**self.flavor)
+ self.flavors.add(flavor)
+
template.add_keypair(self.keypair_name, self.key_uuid)
template.add_security_group(self.secgroup_name)
@@ -136,8 +144,7 @@ class HeatContext(Context):
template.add_network(network.stack_name,
network.physical_network,
network.provider)
- template.add_subnet(network.subnet_stack_name,
- network.stack_name,
+ template.add_subnet(network.subnet_stack_name, network.stack_name,
network.subnet_cidr)
if network.router:
@@ -164,6 +171,13 @@ class HeatContext(Context):
availability_servers.append(server)
break
+ for server in availability_servers:
+ if isinstance(server.flavor, dict):
+ try:
+ self.flavors.add(server.flavor["name"])
+ except KeyError:
+ self.flavors.add(server.stack_name + "-flavor")
+
# add servers with availability policy
added_servers = []
for server in availability_servers: