From 8e96ddfb6a6548a9a7a9b4a686e01378425a1cd8 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 17 Jul 2018 13:19:54 +0200 Subject: Leverage cloudify_ims on Cloudify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also defines 2 new methods to avoid duplicating code: - TenantNetwork1.get_public_auth_url() - VmReady1.publish_image_alt() Shaker and Tempest are updated as well. Change-Id: Ie9095c57c580b95f067d5a8275ad71818b4df335 Signed-off-by: Cédric Ollivier --- functest/core/singlevm.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'functest/core/singlevm.py') diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index ad79a8e14..afc11106d 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -37,6 +37,9 @@ class VmReady1(tenantnetwork.TenantNetwork1): __logger = logging.getLogger(__name__) filename = '/home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img' + image_format = 'qcow2' + filename_alt = None + image_alt_format = image_format visibility = 'private' extra_properties = None flavor_ram = 512 @@ -46,8 +49,6 @@ class VmReady1(tenantnetwork.TenantNetwork1): flavor_alt_vcpus = 1 flavor_alt_disk = 1 - image_format = 'qcow2' - def __init__(self, **kwargs): if "case_name" not in kwargs: kwargs["case_name"] = 'vmready1' @@ -84,6 +85,35 @@ class VmReady1(tenantnetwork.TenantNetwork1): self.__logger.debug("image: %s", image) return image + def publish_image_alt(self, name=None): + """Publish alternative image + + It allows publishing multiple images for the child testcases. It forces + the same configuration for all subtestcases. + + Returns: image + + Raises: expection on error + """ + assert self.cloud + image = self.cloud.create_image( + name if name else '{}-img_alt_{}'.format( + self.case_name, self.guid), + filename=getattr( + config.CONF, '{}_image_alt'.format(self.case_name), + self.filename_alt), + meta=getattr( + config.CONF, '{}_extra_properties'.format(self.case_name), + self.extra_properties), + disk_format=getattr( + config.CONF, '{}_image_alt_format'.format(self.case_name), + self.image_format), + visibility=getattr( + config.CONF, '{}_visibility'.format(self.case_name), + self.visibility)) + self.__logger.debug("image: %s", image) + return image + def create_flavor(self, name=None): """Create flavor -- cgit 1.2.3-korg