summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjuraj.linkes <jlinkes@cisco.com>2016-09-13 14:08:31 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-09-13 13:54:30 +0000
commit250d7019423b94ec9942667591be0de12112d30e (patch)
tree391c637d2ae17f6994a44d289bf4e13d9417cd2e
parenta88f889ccef43cebe100d8eeba6ec788fe358f21 (diff)
Refactored support for flavor and image hugepages based on Morgan's suggestins
Change-Id: I414338616aecda161a51a780abb24c9e3a8f5c54 Signed-off-by: juraj.linkes <jlinkes@cisco.com> (cherry picked from commit a31877af04542bb0cd3c4da6d53f4d4ab580a295)
-rw-r--r--ci/config_patch.yaml6
-rwxr-xr-xutils/openstack_utils.py23
2 files changed, 20 insertions, 9 deletions
diff --git a/ci/config_patch.yaml b/ci/config_patch.yaml
index 4994d49d1..251ab1c4d 100644
--- a/ci/config_patch.yaml
+++ b/ci/config_patch.yaml
@@ -7,4 +7,8 @@ lxd:
healthcheck:
disk_image: /home/opnfv/functest/data/cirros-0.3.4-x86_64-lxc.tar.gz
- disk_format: raw \ No newline at end of file
+ disk_format: raw
+fdio:
+ general:
+ flavor_extra_specs: {'hw:mem_page_size':'large'}
+ image_properties: {'hw_mem_page_size':'large'} \ No newline at end of file
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,