diff options
author | Tomas Cechvala <tcechval@cisco.com> | 2017-03-13 15:18:39 +0100 |
---|---|---|
committer | Juraj Linkeš <jlinkes@cisco.com> | 2017-03-28 09:06:49 +0000 |
commit | 069e5ac29e445ca4141033009bd870a74860472a (patch) | |
tree | 277749bb97dfd905163ca22486e83baf62068bee /testing/robot/lib/FDSLibrary.py | |
parent | e98d863ae414a55b1d306f66f0b54aa659a2c9ae (diff) |
Check for a flavor with hugepages
Flavor is not checked by name but by huge_pages extra option.
It is created when no flavor has huge_pages setting.
Change-Id: I1266a6e58047c24456b12f16fc3061082916558c
Signed-off-by: Tomas Cechvala <tcechval@cisco.com>
Signed-off-by: juraj.linkes <jlinkes@cisco.com>
(cherry picked from commit a717a49967f77ede476da582b6d3bb2c6359da1b)
Diffstat (limited to 'testing/robot/lib/FDSLibrary.py')
-rw-r--r-- | testing/robot/lib/FDSLibrary.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/testing/robot/lib/FDSLibrary.py b/testing/robot/lib/FDSLibrary.py index 32c18eb..0d0929e 100644 --- a/testing/robot/lib/FDSLibrary.py +++ b/testing/robot/lib/FDSLibrary.py @@ -36,12 +36,17 @@ class FDSLibrary(): logger.debug("Initializing nova client.") self.nova_client = nova.Client('2', session=session.Session(auth=auth_obj)) - def check_flavor_exists(self, flavor): - flavor_list_names = [x.name for x in self.nova_client.flavors.list()] - return flavor in flavor_list_names + def check_flavor_exists(self): + flavor_names = [x for x in self.nova_client.flavors.list(min_ram=760)] + for flavor in flavor_names: + for key in flavor.get_keys(): + if "mem_page_size" in key: + logger.info("Found flavor with memory-setting: " + flavor.name) + return flavor.name def create_flavor(self, name, ram, vcpus="1", disk="0"): response = self.nova_client.flavors.create(name, ram, vcpus, disk) + response.set_keys({'hw:mem_page_size': 'large'}) return response def check_image_exists(self, image): |