summaryrefslogtreecommitdiffstats
path: root/functest/core/singlevm.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/core/singlevm.py')
-rw-r--r--functest/core/singlevm.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py
index 42cb5f5ca..768e67d0e 100644
--- a/functest/core/singlevm.py
+++ b/functest/core/singlevm.py
@@ -38,6 +38,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
@@ -48,8 +51,6 @@ class VmReady1(tenantnetwork.TenantNetwork1):
flavor_alt_disk = 1
create_server_timeout = 60
- image_format = 'qcow2'
-
def __init__(self, **kwargs):
if "case_name" not in kwargs:
kwargs["case_name"] = 'vmready1'
@@ -86,6 +87,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