From 5535cb5a9f4769da9a618967f6dd45021924b095 Mon Sep 17 00:00:00 2001 From: Hemanth Nakkina Date: Tue, 7 May 2024 13:43:39 +0530 Subject: [PATCH] [cinder-ceph-k8s] enable image volume cache Add options in cinder-ceph to enable image volume cache and set cache max size and max count. Update cinder conf for cinder-volume service in cinder-ceph-k8s. Change-Id: I3847a0a313d1b94ea3be4ec77c3024c804289258 --- charms/cinder-ceph-k8s/config.yaml | 16 ++++++++++++++++ charms/cinder-ceph-k8s/metadata.yaml | 3 +++ .../cinder-ceph-k8s/src/templates/cinder.conf.j2 | 15 +++++++++++++-- tests/ceph/smoke.yaml.j2 | 2 ++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/charms/cinder-ceph-k8s/config.yaml b/charms/cinder-ceph-k8s/config.yaml index 240f6561..eb25fbe6 100644 --- a/charms/cinder-ceph-k8s/config.yaml +++ b/charms/cinder-ceph-k8s/config.yaml @@ -250,3 +250,19 @@ options: type: boolean default: False description: Enable notifications to send to telemetry. + image-volume-cache-enabled: + type: boolean + default: False + description: | + Enable the image volume cache. + image-volume-cache-max-size-gb: + type: int + default: 0 + description: | + Max size of the image volume cache in GB. 0 means unlimited. + image-volume-cache-max-count: + type: int + default: 0 + description: | + Max number of entries allowed in the image volume cache. 0 means + unlimited. diff --git a/charms/cinder-ceph-k8s/metadata.yaml b/charms/cinder-ceph-k8s/metadata.yaml index ad89cfb6..f9225aa2 100644 --- a/charms/cinder-ceph-k8s/metadata.yaml +++ b/charms/cinder-ceph-k8s/metadata.yaml @@ -39,6 +39,9 @@ requires: database: interface: mysql_client limit: 1 + identity-credentials: + interface: keystone-credentials + optional: true provides: ceph-access: diff --git a/charms/cinder-ceph-k8s/src/templates/cinder.conf.j2 b/charms/cinder-ceph-k8s/src/templates/cinder.conf.j2 index ec95d6a7..b736915f 100644 --- a/charms/cinder-ceph-k8s/src/templates/cinder.conf.j2 +++ b/charms/cinder-ceph-k8s/src/templates/cinder.conf.j2 @@ -18,6 +18,13 @@ transport_url = {{ amqp.transport_url }} enabled_backends = {{ cinder_ceph.backend_name }} cluster = {{ cinder_ceph.cluster_name }} +{% if identity_credentials and identity_credentials.project_id -%} +cinder_internal_tenant_project_id = {{ identity_credentials.project_id }} +{% endif -%} +{% if identity_credentials and identity_credentials.username -%} +cinder_internal_tenant_user_id = {{ identity_credentials.username }} +{% endif -%} + [database] {% if database.connection -%} connection = {{ database.connection }} @@ -37,8 +44,12 @@ rbd_pool = {{ cinder_ceph.rbd_pool }} rbd_user = {{ cinder_ceph.rbd_user }} rbd_secret_uuid = {{ cinder_ceph.secret_uuid }} -{% if cinder_ceph.backend_availability_zone %} +{% if cinder_ceph.backend_availability_zone -%} backend_availability_zone = {{ cinder_ceph.backend_availability_zone }} -{% endif %} +{% endif -%} + +image_volume_cache_enabled = {{ options.image_volume_cache_enabled }} +image_volume_cache_max_size_gb = {{ options.image_volume_cache_max_size_gb }} +image_volume_cache_max_count = {{ options.image_volume_cache_max_count }} {% include "parts/section-oslo-messaging-rabbit" %} diff --git a/tests/ceph/smoke.yaml.j2 b/tests/ceph/smoke.yaml.j2 index e00618d9..d29973fc 100644 --- a/tests/ceph/smoke.yaml.j2 +++ b/tests/ceph/smoke.yaml.j2 @@ -132,6 +132,8 @@ relations: - rabbitmq:amqp - - cinder:storage-backend - cinder-ceph:storage-backend +- - keystone:identity-credentials + - cinder-ceph:identity-credentials - - mysql:database - gnocchi:database