From 8392f34fbc479e04c9e8d803c7b5179a9070cde1 Mon Sep 17 00:00:00 2001 From: Cristina Pauna Date: Fri, 24 Feb 2017 16:41:46 +0200 Subject: 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 --- snaps/openstack/create_image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'snaps/openstack/create_image.py') 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: -- cgit 1.2.3-korg