[glance-k8s] enable image-conversion on import
Allow configuring the images to be imported and converted to row. Disabled by default. Change-Id: If69f7c0260f45038a58ed0695f71e5559730fc32 Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
parent
bd0990f2ad
commit
f22c3d06cb
@ -252,3 +252,10 @@ options:
|
||||
.
|
||||
WARNING: this value should only be increased after careful consideration
|
||||
and must be set to a value under 8EB (9223372036854775808 bytes).
|
||||
image-conversion:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
Enable conversion of all images to raw format during image import.
|
||||
This only works on imported images (for example using 'openstack image create --import').
|
||||
Does not work on regular image uploads (like 'openstack image create')
|
||||
|
@ -21,6 +21,7 @@
|
||||
This charm provide Glance services as part of an OpenStack deployment
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from typing import (
|
||||
@ -216,6 +217,11 @@ class GlanceConfigContext(sunbeam_ctxts.ConfigContext):
|
||||
"image_size_cap": bytes_from_string(
|
||||
self.charm.config["image-size-cap"]
|
||||
),
|
||||
"image_import_plugins": json.dumps(
|
||||
["image_conversion"]
|
||||
if self.charm.config["image-conversion"]
|
||||
else []
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@ -327,6 +333,12 @@ class GlanceOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
self.service_group,
|
||||
0o640,
|
||||
),
|
||||
sunbeam_core.ContainerConfigFile(
|
||||
"/etc/glance/glance-image-import.conf",
|
||||
self.service_user,
|
||||
self.service_group,
|
||||
0o640,
|
||||
),
|
||||
sunbeam_core.ContainerConfigFile(
|
||||
"/usr/local/share/ca-certificates/ca-bundle.pem",
|
||||
self.service_user,
|
||||
|
@ -49,4 +49,3 @@ rbd_store_ceph_conf = /etc/ceph/ceph.conf
|
||||
flavor = keystone
|
||||
|
||||
{% include "parts/section-oslo-messaging-rabbit" %}
|
||||
|
||||
|
13
charms/glance-k8s/src/templates/glance-image-import.conf.j2
Normal file
13
charms/glance-k8s/src/templates/glance-image-import.conf.j2
Normal file
@ -0,0 +1,13 @@
|
||||
###############################################################################
|
||||
# [ WARNING ]
|
||||
# glance configuration file maintained by Juju
|
||||
# local changes may be overwritten.
|
||||
###############################################################################
|
||||
|
||||
[image_import_opts]
|
||||
image_import_plugins = {{ glance_config.image_import_plugins }}
|
||||
|
||||
{% if "image_conversion" in glance_config.image_import_plugins -%}
|
||||
[image_conversion]
|
||||
output_format = raw
|
||||
{% endif %}
|
Loading…
x
Reference in New Issue
Block a user