Reworked instance_type parameter for heat section
Reworked instance_type parameter for heat section:
earlier due to PROD-24633 in case of Octavia, the
[heat]/instance_type parameter was missed because
only one flavor was fetched and it had not > 3 Gb
disk.
Since there is no possibility to fetch more than
1 item from the pillar (more than 1 flavor),
reworked the method to list flavors in Nova and
select correct one.
Change-Id: I615e4e068b33bfc840ac0f83b689cb2e80178e3a
Related-PROD: PROD-24633
diff --git a/_modules/runtest/tempest_sections/heat_plugin.py b/_modules/runtest/tempest_sections/heat_plugin.py
index 4feab0f..3a34d04 100644
--- a/_modules/runtest/tempest_sections/heat_plugin.py
+++ b/_modules/runtest/tempest_sections/heat_plugin.py
@@ -160,15 +160,26 @@
@property
def instance_type(self):
- c = conditions.BaseRule('nova.client.enabled', 'eq', True)
- flavors = self.get_item_when_condition_match(
- 'nova.client.server.admin_identity.flavor', c)
- if not flavors:
+ c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
+ val=True)
+ nodes = self.get_nodes_where_condition_match(c)
+ keystone_profile_admin = self.runtest_opts.get(
+ 'keystone_profile_admin', {})
+ res = self.authenticated_openstack_module_call(
+ nodes[0],
+ 'novang.flavor_list',
+ profile=keystone_profile_admin)[nodes[0]]
+ try:
+ # Need to have > 3 GB disk, but baremetal deployments
+ # can have 120 GB disk flavor, so better to select < 10 Gb.
+ flavors = [f for f in res
+ if (res[f]['disk'] > 3) and (res[f]['disk'] < 10)]
+ except (ValueError, TypeError, KeyError):
+ flavors = None
+ if flavors:
+ return flavors[0]
+ else:
return
- flavor = [f for f in flavors if flavors[f]['disk'] > 3]
- if not flavor:
- return
- return flavor[0]
@property
def ip_version_for_ssh(self):