Add support of image format conversion on importing

Optinally enable conversion of images to raw format when uploading
images to Glance. Only supported when "image_conversion" is enabled in
Glance.

This is an equivalent change to the one in simplestreams:
https://git.launchpad.net/simplestreams/commit/?id=cbc0ac9

Closes-Bug: #1889729
Change-Id: Id15fab364c27242347c520b959065c490e4da6b6
This commit is contained in:
Yoshi Kadokawa 2021-09-16 11:24:56 +09:00 committed by Nobuto Murata
parent c6a07458dc
commit 536540781a
4 changed files with 13 additions and 1 deletions

View File

@ -138,3 +138,9 @@ options:
OpenStack mostly defaults to using public endpoints for internal
communication between services. If set to True this option will
configure services to use internal endpoints where possible.
image_import_conversion:
type: boolean
default: False
description: |
Enable conversion of images to raw format when uploading images to Glance.
Only supported when "image_conversion" is enabled in Glance.

View File

@ -299,6 +299,10 @@ def do_sync(ksc, charm_conf):
'--custom-property',
custom_property
]
if charm_conf.get('image_import_conversion', False):
sync_command += [
'--image-import-conversion'
]
if charm_conf.get('set_latest_property', False):
sync_command += [

View File

@ -183,7 +183,8 @@ class MirrorsConfigServiceContext(OSContextGenerator):
user_agent=config['user_agent'],
custom_properties=config['custom_properties'],
hypervisor_mapping=config['hypervisor_mapping'],
set_latest_property=config['set_latest_property'])
set_latest_property=config['set_latest_property'],
image_import_conversion=config['image_import_conversion'])
def ensure_perms():

View File

@ -9,6 +9,7 @@ region: {{ region }}
cloud_name: {{ cloud_name }}
content_id_template: {{ content_id_template }}
hypervisor_mapping: {{ hypervisor_mapping }}
image_import_conversion: {{ image_import_conversion }}
{% if custom_properties %}
custom_properties: {{ custom_properties }}
{% endif %}