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
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))
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,