summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/create_image.py
diff options
context:
space:
mode:
authorCristina Pauna <cristina.pauna@enea.com>2017-02-24 16:41:46 +0200
committerCristina Pauna <cristina.pauna@enea.com>2017-03-01 17:10:34 +0200
commit8392f34fbc479e04c9e8d803c7b5179a9070cde1 (patch)
treec4588b7ddc9868cab5da1aeafda6cfd5a9466d09 /snaps/openstack/create_image.py
parentc613af85630307c1c50ccd109d8c4efae5f0265b (diff)
Add support for extra properties in an image
This patch adds a new setting for images, extra_properties. This field is a dict and can be used to create a 3-part image by setting the kernel_id and the ramdisk_id of the main image. Unit tests have been added to set some generic property, for creation of the 3-part image, and for creating an instance with that 3-part image JIRA: SNAPS-32 Change-Id: Ifb53d1da1085fcd6429ddc0607c905522db5e8bb Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
Diffstat (limited to 'snaps/openstack/create_image.py')
-rw-r--r--snaps/openstack/create_image.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/snaps/openstack/create_image.py b/snaps/openstack/create_image.py
index e1b8d94..bffa7de 100644
--- a/snaps/openstack/create_image.py
+++ b/snaps/openstack/create_image.py
@@ -150,7 +150,7 @@ class OpenStackImage:
class ImageSettings:
def __init__(self, config=None, name=None, image_user=None, img_format=None, url=None, image_file=None,
- nic_config_pb_loc=None):
+ extra_properties=None, nic_config_pb_loc=None):
"""
:param config: dict() object containing the configuration settings using the attribute names below as each
@@ -160,6 +160,8 @@ class ImageSettings:
:param img_format: the image type (required)
:param url: the image download location (requires url or img_file)
:param image_file: the image file location (requires url or img_file)
+ :param extra_properties: dict() object containing extra parameters to pass when loading the image;
+ can be ids of kernel and initramfs images for a 3-part image
:param nic_config_pb_loc: the file location to the Ansible Playbook that can configure multiple NICs
"""
@@ -169,6 +171,7 @@ class ImageSettings:
self.format = config.get('format')
self.url = config.get('download_url')
self.image_file = config.get('image_file')
+ self.extra_properties = config.get('extra_properties')
self.nic_config_pb_loc = config.get('nic_config_pb_loc')
else:
self.name = name
@@ -176,6 +179,7 @@ class ImageSettings:
self.format = img_format
self.url = url
self.image_file = image_file
+ self.extra_properties = extra_properties
self.nic_config_pb_loc = nic_config_pb_loc
if not self.name or not self.image_user or not self.format: