diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-17 13:19:54 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-17 14:09:24 +0200 |
commit | 8e96ddfb6a6548a9a7a9b4a686e01378425a1cd8 (patch) | |
tree | 4cc932a83942c8c8d97e32e298341ae868d373c1 /functest/core/singlevm.py | |
parent | 6812e47c760a202c920271bcc87b3d183b2f61e1 (diff) |
Leverage cloudify_ims on Cloudify
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 <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/core/singlevm.py')
-rw-r--r-- | functest/core/singlevm.py | 34 |
1 files changed, 32 insertions, 2 deletions
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 |