aboutsummaryrefslogtreecommitdiffstats
path: root/utils/openstack_utils.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2016-09-12 14:27:28 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-09-12 14:27:28 +0000
commitc0e15d39c9755a5dd7e1e086789d30561e0bf848 (patch)
treec3443cae3730404a9e5e69b1a14500d438a4bfb2 /utils/openstack_utils.py
parent8cfb05465b9069960e45ffdf50e5cf987f0e8693 (diff)
parent20a2b8d2451c5f026deda8197ecc6e6aa0b83d38 (diff)
Merge "Added support for creating images and flavors with hugepages for fdio scenarios"
Diffstat (limited to 'utils/openstack_utils.py')
-rwxr-xr-xutils/openstack_utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index ff9b54a5..03279f63 100755
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -235,6 +235,11 @@ 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'
+ flavor.update(extra_specs)
except Exception, e:
logger.error("Error [create_flavor(nova_client, '%s', '%s', '%s', "
"'%s')]: %s" % (flavor_name, ram, disk, vcpus, e))
@@ -902,11 +907,16 @@ 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'
with open(file_path) as fimage:
image = glance_client.images.create(name=image_name,
is_public=public,
disk_format=disk,
container_format=container,
+ properties=properties,
data=fimage)
image_id = image.id
return image_id