diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-09-13 13:42:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-09-13 13:42:00 +0000 |
commit | 60b1378663af737b0ae79caf2c5f116cc69c3795 (patch) | |
tree | 15a5664dd8a271faf79b84d3ce0956ea28505020 /utils | |
parent | a5bdcbf651016ed552967ed124c5fb2a19ad3d98 (diff) | |
parent | a31877af04542bb0cd3c4da6d53f4d4ab580a295 (diff) |
Merge "Refactored support for flavor and image hugepages based on Morgan's suggestins"
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/openstack_utils.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py index 03279f63d..8c2e00cb1 100755 --- a/utils/openstack_utils.py +++ b/utils/openstack_utils.py @@ -16,6 +16,7 @@ import time from cinderclient import client as cinderclient import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as ft_utils from glanceclient import client as glanceclient from keystoneclient.v2_0 import client as keystoneclient from neutronclient.v2_0 import client as neutronclient @@ -235,11 +236,14 @@ def get_hypervisors(nova_client): def create_flavor(nova_client, flavor_name, ram, disk, vcpus): try: flavor = nova_client.flavors.create(flavor_name, ram, vcpus, disk) - extra_specs = {} - deploy_scenario = os.environ.get('DEPLOY_SCENARIO') - if deploy_scenario is not None and 'fdio' in deploy_scenario: - extra_specs['hw:mem_page_size'] = 'large' + try: + extra_specs = ft_utils.get_functest_config( + 'general.flavor_extra_specs') flavor.update(extra_specs) + except ValueError: + # flavor extra specs are not configured, therefore skip the update + pass + except Exception, e: logger.error("Error [create_flavor(nova_client, '%s', '%s', '%s', " "'%s')]: %s" % (flavor_name, ram, disk, vcpus, e)) @@ -907,10 +911,13 @@ def create_glance_image(glance_client, image_name, file_path, disk="qcow2", if logger: logger.info("Creating image '%s' from '%s'..." % (image_name, file_path)) - properties = {} - deploy_scenario = os.environ.get('DEPLOY_SCENARIO') - if deploy_scenario is not None and 'fdio' in deploy_scenario: - properties['hw_mem_page_size'] = 'large' + try: + properties = ft_utils.get_functest_config( + 'general.image_properties') + except ValueError: + # image properties are not configured + # therefore don't add any properties + properties = {} with open(file_path) as fimage: image = glance_client.images.create(name=image_name, is_public=public, |