Merge "Allow to set conditions on components"

This commit is contained in:
Zuul
2025-10-23 12:37:58 +00:00
committed by Gerrit Code Review
3 changed files with 20 additions and 6 deletions

View File

@@ -122,6 +122,12 @@ cephkeys_access_group: ceph
openstack_service_system_user:
ceph_cinder_backup_enabled: >-
{{
(cinder_service_backup_program_enabled is defined and cinder_service_backup_program_enabled | bool) and
(cinder_service_backup_driver is defined and 'ceph' in cinder_service_backup_driver)
}}
ceph_cinder_service_names:
- cinder-volume
- cinder-backup

View File

@@ -0,0 +1,11 @@
---
features:
- |
Added support for ``condition`` key for ``ceph_extra_components`` mapping,
which could be used to define a more narrow conditions when component
should be having ceph mappings.
- |
Introduced variable ``ceph_cinder_backup_enabled`` which can be manually
overriden to enable provisionment of Ceph client to ``cinder-backup``
service. Previously logic for this has been hardcoded and not easily
overridable.

View File

@@ -30,6 +30,7 @@ _ceph_components:
client:
- name: "{{ cinder_backup_ceph_client }}"
service: "{{ ceph_cinder_service_names }}"
condition: "{{ ceph_cinder_backup_enabled }}"
- component: nova_compute
package: "{{ (libvirt_packages + ['ceph-common'] + ceph_immutable_object_cache_packages + python_ceph_packages) | select }}"
client:
@@ -75,15 +76,11 @@ ceph_client_filtered_clients: |-
{% set clients = [] %}
{% for comp in (ceph_components + ceph_extra_components) %}
{% if comp.component in group_names %}
{% if ((comp.component != 'cinder_backup') or
((cinder_service_backup_program_enabled is defined and
cinder_service_backup_program_enabled | bool) and
(cinder_service_backup_driver is defined and
'ceph' in cinder_service_backup_driver))) %}
{% if comp.get('condition', true) %}
{% for client in comp.client %}
{% if client is not mapping %}
{% set _ = clients.append({'name': client}) %}
{% elif client['enabled'] | default(true) | bool %}
{% elif client['enabled'] | default(true) | bool %}
{% set _ = clients.append(client) %}
{% endif %}
{% endfor %}