summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvitikkan <viktor.tikkanen@nokia.com>2016-06-13 13:29:38 +0300
committervitikkan <viktor.tikkanen@nokia.com>2016-06-13 13:35:43 +0300
commit050ced665b9c364857c1c8b056d9c57069fd0dc5 (patch)
treebc8f9a1450f8da60b25b68320596e8934f217ad2
parentc1f3735e32c61ffedb04bdc542a142ac04f6dbd7 (diff)
Creating Glance image for Tempest suite
If not yet existing, Cirros-0.3.4 image is created before running Tempest test suite. Source file for the image is included into opnfv/functest Docker container. JIRA: FUNCTEST-195 Change-Id: I980193c4207c1301ca4e3b6e850b4056e6aa0130 Signed-off-by: vitikkan <viktor.tikkanen@nokia.com>
-rw-r--r--ci/config_functest.yaml2
-rw-r--r--testcases/OpenStack/tempest/run_tempest.py30
2 files changed, 31 insertions, 1 deletions
diff --git a/ci/config_functest.yaml b/ci/config_functest.yaml
index 69f263f04..4c673fab6 100644
--- a/ci/config_functest.yaml
+++ b/ci/config_functest.yaml
@@ -29,7 +29,7 @@ general:
dir_rally_inst: /home/opnfv/.rally
openstack:
- image_name: functest-img
+ image_name: Cirros-0.3.4
image_file_name: cirros-0.3.4-x86_64-disk.img
image_disk_format: qcow2
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py
index 46b01898f..f59ba5263 100644
--- a/testcases/OpenStack/tempest/run_tempest.py
+++ b/testcases/OpenStack/tempest/run_tempest.py
@@ -24,6 +24,7 @@ import yaml
import ConfigParser
import keystoneclient.v2_0.client as ksclient
+from glanceclient import client as glanceclient
from neutronclient.v2_0 import client as neutronclient
import functest.utils.functest_logger as ft_logger
@@ -66,6 +67,14 @@ f.close()
TEST_DB = functest_yaml.get("results").get("test_db_url")
MODE = "smoke"
+GLANCE_IMAGE_NAME = functest_yaml.get("general").get(
+ "openstack").get("image_name")
+GLANCE_IMAGE_FILENAME = functest_yaml.get("general").get(
+ "openstack").get("image_file_name")
+GLANCE_IMAGE_FORMAT = functest_yaml.get("general").get(
+ "openstack").get("image_disk_format")
+GLANCE_IMAGE_PATH = functest_yaml.get("general").get("directories").get(
+ "dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME
PRIVATE_NET_NAME = functest_yaml.get("tempest").get("private_net_name")
PRIVATE_SUBNET_NAME = functest_yaml.get("tempest").get("private_subnet_name")
PRIVATE_SUBNET_CIDR = functest_yaml.get("tempest").get("private_subnet_cidr")
@@ -149,6 +158,27 @@ def create_tempest_resources():
logger.error("Private network creation failed")
exit(-1)
+ logger.debug("Creating image for Tempest suite")
+ glance_endpoint = keystone.service_catalog.url_for(
+ service_type='image', endpoint_type='publicURL')
+ glance_client = glanceclient.Client(1, glance_endpoint,
+ token=keystone.auth_token)
+ # Check if the given image exists
+ image_id = os_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME)
+ if image_id != '':
+ logger.info("Using existing image '%s'..." % GLANCE_IMAGE_NAME)
+ else:
+ logger.info("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME,
+ GLANCE_IMAGE_PATH))
+ image_id = os_utils.create_glance_image(glance_client,
+ GLANCE_IMAGE_NAME,
+ GLANCE_IMAGE_PATH)
+ if not image_id:
+ logger.error("Failed to create a Glance image...")
+ exit(-1)
+ logger.debug("Image '%s' with ID=%s created successfully."
+ % (GLANCE_IMAGE_NAME, image_id))
+
def configure_tempest(deployment_dir):
"""