aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-09-27 10:02:15 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-09-27 10:02:15 +0000
commit0e7ef6e103809f9f13c2b533eb589c3ac9c3fe14 (patch)
treea96bb0bc1886f1b97c776e526dea7bd3adfceefb
parent84ce9e79698a413a26ce283212350f08a7575a55 (diff)
parent40f68e35389cf19d3fb200d1655ecb055c85d1eb (diff)
Merge "Move sfc custom flavor creation"
-rwxr-xr-xtestcases/features/sfc/sfc.py6
-rwxr-xr-xtestcases/features/sfc/sfc_colorado1.py6
-rwxr-xr-xutils/openstack_utils.py10
3 files changed, 18 insertions, 4 deletions
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index 2eb56ac1..a97ebcea 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -169,6 +169,12 @@ def main():
port_range_min=80,
port_range_max=80)
+ _, custom_flv_id = os_utils.get_or_create_flavor(
+ 'custom', 1500, 10, 1, public=True)
+ if not custom_flv_id:
+ logger.error("Failed to create custom flavor")
+ sys.exit(1)
+
# boot INSTANCE
logger.info("Creating instance '%s'..." % INSTANCE_NAME)
logger.debug(
diff --git a/testcases/features/sfc/sfc_colorado1.py b/testcases/features/sfc/sfc_colorado1.py
index f40b8b50..8ae4e6ba 100755
--- a/testcases/features/sfc/sfc_colorado1.py
+++ b/testcases/features/sfc/sfc_colorado1.py
@@ -168,6 +168,12 @@ def main():
port_range_min=80,
port_range_max=80)
+ _, custom_flv_id = os_utils.get_or_create_flavor(
+ 'custom', 1500, 10, 1, public=True)
+ if not custom_flv_id:
+ logger.error("Failed to create custom flavor")
+ sys.exit(1)
+
iterator = 0
while(iterator < 6):
# boot INSTANCE
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index da9bc5a1..e0da7d97 100755
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -211,9 +211,10 @@ def get_flavor_id_by_ram_range(nova_client, min_ram, max_ram):
return id
-def create_flavor(nova_client, flavor_name, ram, disk, vcpus):
+def create_flavor(nova_client, flavor_name, ram, disk, vcpus, public=True):
try:
- flavor = nova_client.flavors.create(flavor_name, ram, vcpus, disk)
+ flavor = nova_client.flavors.create(
+ flavor_name, ram, vcpus, disk, is_public=public)
try:
extra_specs = ft_utils.get_functest_config(
'general.flavor_extra_specs')
@@ -229,7 +230,7 @@ def create_flavor(nova_client, flavor_name, ram, disk, vcpus):
return flavor.id
-def get_or_create_flavor(flavor_name, ram, disk, vcpus):
+def get_or_create_flavor(flavor_name, ram, disk, vcpus, public=True):
flavor_exists = False
nova_client = get_nova_client()
@@ -240,7 +241,8 @@ def get_or_create_flavor(flavor_name, ram, disk, vcpus):
else:
logger.info("Creating flavor '%s' with '%s' RAM, '%s' disk size, "
"'%s' vcpus..." % (flavor_name, ram, disk, vcpus))
- flavor_id = create_flavor(nova_client, flavor_name, ram, disk, vcpus)
+ flavor_id = create_flavor(
+ nova_client, flavor_name, ram, disk, vcpus, public=public)
if not flavor_id:
logger.error("Failed to create flavor '%s'..." % (flavor_name))
else: