aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-13 21:59:22 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-13 22:01:34 +0200
commit8d3eb364d84f90b19f9e7234d01add8764843081 (patch)
treecbaaf6c49a9de1d855ac7165361265d4fb2ed491
parent484acb3716b6f6261793b8a6a0220cce62ccb0c3 (diff)
Allow setting two image extra properties per testcase
It conforms with the flavor extra specs model [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/60713/ Change-Id: I1555a313aaf56ae47f9ad2a4529eb8b94e636c00 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/core/singlevm.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py
index 846e19892..500a44b59 100644
--- a/functest/core/singlevm.py
+++ b/functest/core/singlevm.py
@@ -39,7 +39,7 @@ class VmReady1(tenantnetwork.TenantNetwork1):
__logger = logging.getLogger(__name__)
filename = '/home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img'
image_format = 'qcow2'
- extra_properties = None
+ extra_properties = {}
filename_alt = filename
image_alt_format = image_format
extra_alt_properties = extra_properties
@@ -73,14 +73,16 @@ class VmReady1(tenantnetwork.TenantNetwork1):
Raises: expection on error
"""
assert self.cloud
+ extra_properties = self.extra_properties.copy()
+ extra_properties.update(
+ getattr(config.CONF, '{}_extra_properties'.format(
+ self.case_name), {}))
image = self.cloud.create_image(
name if name else '{}-img_{}'.format(self.case_name, self.guid),
filename=getattr(
config.CONF, '{}_image'.format(self.case_name),
self.filename),
- meta=getattr(
- config.CONF, '{}_extra_properties'.format(self.case_name),
- self.extra_properties),
+ meta=extra_properties,
disk_format=getattr(
config.CONF, '{}_image_format'.format(self.case_name),
self.image_format),
@@ -102,15 +104,17 @@ class VmReady1(tenantnetwork.TenantNetwork1):
Raises: expection on error
"""
assert self.cloud
+ extra_alt_properties = self.extra_alt_properties.copy()
+ extra_alt_properties.update(
+ getattr(config.CONF, '{}_extra_alt_properties'.format(
+ self.case_name), {}))
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_alt_properties'.format(self.case_name),
- self.extra_properties),
+ meta=extra_alt_properties,
disk_format=getattr(
config.CONF, '{}_image_alt_format'.format(self.case_name),
self.image_format),
@@ -141,11 +145,11 @@ class VmReady1(tenantnetwork.TenantNetwork1):
getattr(config.CONF, '{}_flavor_disk'.format(self.case_name),
self.flavor_disk))
self.__logger.debug("flavor: %s", flavor)
- flavor_extra_specs_updated = self.flavor_extra_specs.copy()
- flavor_extra_specs_updated.update(
+ flavor_extra_specs = self.flavor_extra_specs.copy()
+ flavor_extra_specs.update(
getattr(config.CONF,
'{}_flavor_extra_specs'.format(self.case_name), {}))
- self.orig_cloud.set_flavor_specs(flavor.id, flavor_extra_specs_updated)
+ self.orig_cloud.set_flavor_specs(flavor.id, flavor_extra_specs)
return flavor
def create_flavor_alt(self, name=None):
@@ -169,12 +173,12 @@ class VmReady1(tenantnetwork.TenantNetwork1):
getattr(config.CONF, '{}_flavor_alt_disk'.format(self.case_name),
self.flavor_alt_disk))
self.__logger.debug("flavor: %s", flavor)
- flavor_alt_extra_specs_updated = self.flavor_alt_extra_specs.copy()
- flavor_alt_extra_specs_updated.update(
+ flavor_alt_extra_specs = self.flavor_alt_extra_specs.copy()
+ flavor_alt_extra_specs.update(
getattr(config.CONF,
'{}_flavor_alt_extra_specs'.format(self.case_name), {}))
self.orig_cloud.set_flavor_specs(
- flavor.id, flavor_alt_extra_specs_updated)
+ flavor.id, flavor_alt_extra_specs)
return flavor
def boot_vm(self, name=None, **kwargs):