From 587dfa92ee0f349af56012e0948428c4cc7e2027 Mon Sep 17 00:00:00 2001 From: Jerome Pansanel Date: Mon, 20 Nov 2017 14:53:59 +0100 Subject: [PATCH] Add new image descriptors (visibility and min_ram) --- cloudkeeper_os/config.py | 6 +++++- cloudkeeper_os/imagemanager.py | 5 ++++- etc/cloudkeeper-os/cloudkeeper-os.conf.sample | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cloudkeeper_os/config.py b/cloudkeeper_os/config.py index 9bcef66..da2e2f9 100644 --- a/cloudkeeper_os/config.py +++ b/cloudkeeper_os/config.py @@ -32,7 +32,11 @@ 'are stored.'), cfg.StrOpt('tempdir', default='/tmp', - help='Directory where the images are downloaded') + help='Directory where the images are downloaded'), + cfg.StrOpt('image_visibility', + default='private', + choices=['public', 'private', 'shared', 'community'], + help='Visibility of images uploaded to OpenStack'), ] cfg.CONF.register_opts(DEFAULT_OPTS) diff --git a/cloudkeeper_os/imagemanager.py b/cloudkeeper_os/imagemanager.py index ebad361..56a7a12 100644 --- a/cloudkeeper_os/imagemanager.py +++ b/cloudkeeper_os/imagemanager.py @@ -86,6 +86,7 @@ def add_appliance(self, appliance): appliance.ClearField('image') properties = utils.extract_appliance_properties(appliance) + min_ram = int(properties.get("APPLIANCE_RAM", 0)) LOG.debug("Creating image '%s' (format: '%s', " "properties %s)" % (appliance.title, @@ -95,7 +96,9 @@ def add_appliance(self, appliance): glance_image = glance.images.create(name=appliance.title, disk_format=str.lower(image_format), - container_format="bare" + container_format="bare", + visibility=CONF.image_visibility, + min_ram=min_ram ) glance.images.upload(glance_image.id, image_data) glance.images.update(glance_image.id, **properties) diff --git a/etc/cloudkeeper-os/cloudkeeper-os.conf.sample b/etc/cloudkeeper-os/cloudkeeper-os.conf.sample index d958190..3b22086 100644 --- a/etc/cloudkeeper-os/cloudkeeper-os.conf.sample +++ b/etc/cloudkeeper-os/cloudkeeper-os.conf.sample @@ -14,6 +14,10 @@ # Directory where the images are downloaded (string value) #tempdir = /tmp + +# Visibility of images uploaded to OpenStack (string value) +# Allowed values: public, private, shared, community +#image_visibility = private # # From oslo.log