From 779f1c846fed268fa1f684af47530c4988d9323d Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Mon, 27 Jan 2020 09:06:54 -0800 Subject: [PATCH] Add support for glance multistore Add parameters to support deploying multiple glance-api backends. The existing GlanceBackend parameter specifies the first backend, and it's the default backend when multiple backends are defined. Additional backends are defined using a new GlanceMultistoreConfig parameter. The data is a hash where the keys are the glance backend identifier and the data is the glance settings for that backend. A new GlanceStoreDescription lets the user to provide a description for each backend. The configuration can specify any combination of supported backend types. Multiple rbd backends can be specified, but cinder, file and swift backends are limited to one each. Change-Id: Ifc538250815f0ce0e534cae443037e143309ca56 Depends-On: I41ab9b3593bf3d078c5bbd1826df8308e3f5e7af (cherry picked from commit 96937674a7524275b52d90d4b3a0f94c0e384937) --- ci/environments/scenario001-standalone.yaml | 8 +- .../glance/glance-api-container-puppet.yaml | 101 +++++++++++++++--- .../glance-multistore-82d4fc260acfb355.yaml | 12 +++ 3 files changed, 103 insertions(+), 18 deletions(-) create mode 100644 releasenotes/notes/glance-multistore-82d4fc260acfb355.yaml diff --git a/ci/environments/scenario001-standalone.yaml b/ci/environments/scenario001-standalone.yaml index aca87b033a..facd3127ea 100644 --- a/ci/environments/scenario001-standalone.yaml +++ b/ci/environments/scenario001-standalone.yaml @@ -128,7 +128,13 @@ parameter_defaults: NovaEnableRbdBackend: true CinderEnableRbdBackend: true CinderBackupBackend: ceph - GlanceBackend: rbd + GlanceBackend: cinder + GlanceStoreDescription: 'Cinder glance store' + GlanceMultistoreConfig: + rbd_store: + GlanceBackend: rbd + GlanceStoreDescription: 'RBD glance store' + CephClientUserName: 'glance' GnocchiBackend: rbd CinderEnableIscsiBackend: false GnocchiArchivePolicy: 'ceilometer-high-rate' diff --git a/deployment/glance/glance-api-container-puppet.yaml b/deployment/glance/glance-api-container-puppet.yaml index 853d33698e..97cb22e6af 100644 --- a/deployment/glance/glance-api-container-puppet.yaml +++ b/deployment/glance/glance-api-container-puppet.yaml @@ -206,6 +206,40 @@ parameters: type: string constraints: - allowed_values: ['swift', 'file', 'rbd', 'cinder'] + GlanceBackendID: + type: string + default: 'default_backend' + description: The default backend's identifier. + constraints: + - allowed_pattern: "[a-zA-Z0-9_-]+" + GlanceStoreDescription: + type: string + default: 'Default glance store backend.' + description: User facing description for the Glance backend. + GlanceMultistoreConfig: + type: json + default: {} + description: | + Dictionary of settings when configuring additional glance backends. The + hash key is the backend ID, and the value is a dictionary of parameter + values unique to that backend. Multiple rbd backends are allowed, but + cinder, file and swift backends are limited to one each. Example: + # Default glance store is rbd. + GlanceBackend: rbd + GlanceStoreDescription: 'Default rbd store' + # GlanceMultistoreConfig specifies a second rbd backend, plus a cinder + # backend. + GlanceMultistoreConfig: + rbd2_store: + GlanceBackend: rbd + GlanceStoreDescription: 'Second rbd store' + CephClusterName: ceph2 + # Override CephClientUserName if this cluster uses a different + # client name. + CephClientUserName: client2 + cinder_store: + GlanceBackend: cinder + GlanceStoreDescription: 'Cinder store' CephClientUserName: default: openstack type: string @@ -236,17 +270,35 @@ parameters: conditions: internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]} - cinder_backend_enabled: {equals: [{get_param: GlanceBackend}, cinder]} + cinder_backend_enabled: + or: + - equals: + - get_param: GlanceBackend + - cinder + - equals: + - yaql: + expression: $.data.values().any($.get("GlanceBackend", "") = "cinder") + data: {get_param: GlanceMultistoreConfig} + - true cinder_multipathd_enabled: and: - cinder_backend_enabled - equals: - get_param: MultipathdEnable - true - rbd_backend_enabled: {equals: [{get_param: GlanceBackend}, rbd]} + rbd_backend_enabled: + or: + - equals: + - get_param: GlanceBackend + - rbd + - equals: + - yaql: + expression: $.data.values().any($.get("GlanceBackend", "") = "rbd") + data: {get_param: GlanceMultistoreConfig} + - true enable_image_conversion: and: - - equals: [{get_param: GlanceBackend}, rbd] + - rbd_backend_enabled - equals: [{get_param: NovaEnableRbdBackend}, true] use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]} glance_workers_unset: {equals : [{get_param: GlanceWorkers}, '']} @@ -259,9 +311,7 @@ conditions: - glance_netapp_nfs_enabled - and: # Keep this for compat, but ignore NovaEnableRbdBackend if it's a role param - - equals: - - get_param: GlanceBackend - - rbd + - rbd_backend_enabled - equals: - get_param: NovaEnableRbdBackend - true @@ -409,6 +459,9 @@ outputs: glance::backend::rbd::rbd_store_pool: {get_param: GlanceRbdPoolName} glance::backend::rbd::rbd_store_user: {get_param: CephClientUserName} glance_backend: {get_param: GlanceBackend} + tripleo::profile::base::glance::api::glance_backend_id: {get_param: GlanceBackendID} + tripleo::profile::base::glance::api::glance_store_description: {get_param: GlanceStoreDescription} + tripleo::profile::base::glance::api::multistore_config: {get_param: GlanceMultistoreConfig} glance::notify::rabbitmq::notification_driver: {get_param: NotificationDriver} - if: @@ -483,17 +536,31 @@ outputs: merge: true preserve_properties: true permissions: - - path: /var/lib/glance - owner: glance:glance - recurse: true - - path: - str_replace: - template: /etc/ceph/CLUSTER.client.USER.keyring - params: - CLUSTER: {get_param: CephClusterName} - USER: {get_param: CephClientUserName} - owner: glance:glance - perm: '0600' + list_concat: + - + - path: /var/lib/glance + owner: glance:glance + recurse: true + - path: + str_replace: + template: /etc/ceph/CLUSTER.client.USER.keyring + params: + CLUSTER: {get_param: CephClusterName} + USER: {get_param: CephClientUserName} + owner: glance:glance + perm: '0600' + - repeat: + template: + path: /etc/ceph/<%keyring%> + owner: glance:glance + perm: '0600' + for_each: + <%keyring%>: + yaql: + expression: let(u => $.data.user) -> $.data.multistore.values().where($.get("CephClusterName")).select("{0}.client.{1}.keyring".format($.CephClusterName, $.get("CephClientUserName", $u))) + data: + user: {get_param: CephClientUserName} + multistore: {get_param: GlanceMultistoreConfig} /var/lib/kolla/config_files/glance_api_tls_proxy.json: command: /usr/sbin/httpd -DFOREGROUND config_files: diff --git a/releasenotes/notes/glance-multistore-82d4fc260acfb355.yaml b/releasenotes/notes/glance-multistore-82d4fc260acfb355.yaml new file mode 100644 index 0000000000..1196bb2c96 --- /dev/null +++ b/releasenotes/notes/glance-multistore-82d4fc260acfb355.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + Add parameters for configuring multiple glance-api backends. The existing + ``GlanceBackend`` parameter represents the default backend, and a new + ``GlanceMultistoreConfig`` parameter is a hash representing the + configuration of additional backends. A new ``GlanceStoreDescription`` + parameter provides a means of describing each backend. + + The configuration can specify any combination of supported backend types. + Multiple rbd backends can be specified, but cinder, file and swift + backends are limited to one each.