Image properties in scenario tests
Some images require additional properties. This change adds dictionary option "img_properties" to the "scenario" config section. For example, to work with Parallels Containers, specify vm_mode: img_properties = vm_mode:exe By occasion, we fix handling properties in _image_create in scenario/manager.py: disk_format is an x-image-meta-* option, and kernel_id, ramdisk_id are properties. Change-Id: I2d3714eb899faad67a867a630c1d72d1fd8ee74f
This commit is contained in:
parent
40bec6595c
commit
7ba0d5fc8a
@ -935,6 +935,10 @@
|
||||
# Image container format (string value)
|
||||
#img_container_format = bare
|
||||
|
||||
# Glance image properties. Use for custom images which require them
|
||||
# (dict value)
|
||||
#img_properties = <None>
|
||||
|
||||
# AMI image file name (string value)
|
||||
#ami_img_file = cirros-0.3.1-x86_64-blank.img
|
||||
|
||||
|
@ -943,6 +943,8 @@ ScenarioGroup = [
|
||||
cfg.StrOpt('img_container_format',
|
||||
default='bare',
|
||||
help='Image container format'),
|
||||
cfg.DictOpt('img_properties', help='Glance image properties. '
|
||||
'Use for custom images which require them'),
|
||||
cfg.StrOpt('ami_img_file',
|
||||
default='cirros-0.3.1-x86_64-blank.img',
|
||||
help='AMI image file name'),
|
||||
|
@ -318,7 +318,8 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
|
||||
return linux_client
|
||||
|
||||
def _image_create(self, name, fmt, path, properties=None):
|
||||
def _image_create(self, name, fmt, path,
|
||||
disk_format=None, properties=None):
|
||||
if properties is None:
|
||||
properties = {}
|
||||
name = data_utils.rand_name('%s-' % name)
|
||||
@ -327,10 +328,10 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
params = {
|
||||
'name': name,
|
||||
'container_format': fmt,
|
||||
'disk_format': fmt,
|
||||
'disk_format': disk_format or fmt,
|
||||
'is_public': 'False',
|
||||
}
|
||||
params.update(properties)
|
||||
params['properties'] = properties
|
||||
image = self.image_client.create_image(**params)
|
||||
self.addCleanup(self.image_client.delete_image, image['id'])
|
||||
self.assertEqual("queued", image['status'])
|
||||
@ -344,23 +345,22 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
ami_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ami_img_file
|
||||
img_container_format = CONF.scenario.img_container_format
|
||||
img_disk_format = CONF.scenario.img_disk_format
|
||||
img_properties = CONF.scenario.img_properties
|
||||
LOG.debug("paths: img: %s, container_fomat: %s, disk_format: %s, "
|
||||
"ami: %s, ari: %s, aki: %s" %
|
||||
"properties: %s, ami: %s, ari: %s, aki: %s" %
|
||||
(img_path, img_container_format, img_disk_format,
|
||||
ami_img_path, ari_img_path, aki_img_path))
|
||||
img_properties, ami_img_path, ari_img_path, aki_img_path))
|
||||
try:
|
||||
self.image = self._image_create('scenario-img',
|
||||
img_container_format,
|
||||
img_path,
|
||||
properties={'disk_format':
|
||||
img_disk_format})
|
||||
disk_format=img_disk_format,
|
||||
properties=img_properties)
|
||||
except IOError:
|
||||
LOG.debug("A qcow2 image was not found. Try to get a uec image.")
|
||||
kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
|
||||
ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
|
||||
properties = {
|
||||
'properties': {'kernel_id': kernel, 'ramdisk_id': ramdisk}
|
||||
}
|
||||
properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}
|
||||
self.image = self._image_create('scenario-ami', 'ami',
|
||||
path=ami_img_path,
|
||||
properties=properties)
|
||||
|
Loading…
x
Reference in New Issue
Block a user