Merge "Fix linters and metadata"

This commit is contained in:
Zuul 2023-08-14 10:48:17 +00:00 committed by Gerrit Code Review
commit 5f6e86a7da
12 changed files with 139 additions and 68 deletions

View File

@ -21,7 +21,11 @@ cinder_package_state: "{{ package_state | default('latest') }}"
# for the service setup. The host must already have
# clouds.yaml properly configured.
cinder_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
cinder_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((cinder_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
cinder_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(cinder_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
# Set installation method.
cinder_install_method: "{{ service_install_method | default('source') }}"
@ -29,7 +33,8 @@ cinder_venv_python_executable: "{{ openstack_venv_python_executable | default('p
cinder_git_repo: https://opendev.org/openstack/cinder
cinder_git_install_branch: master
cinder_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
cinder_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
cinder_git_constraints:
- "--constraint {{ cinder_upper_constraints_url }}"
@ -64,7 +69,11 @@ cinder_fatal_deprecations: False
## Database info
cinder_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
cinder_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((cinder_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
cinder_db_setup_python_interpreter: >-
{{
openstack_db_setup_python_interpreter | default(
(cinder_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
cinder_galera_address: "{{ galera_address | default('127.0.0.1') }}"
cinder_galera_user: cinder
cinder_galera_database: cinder
@ -230,7 +239,8 @@ cinder_swift_catalog_info: "object-store:swift:internalURL"
## Cap the maximun number of threads / workers when a user value is unspecified.
cinder_osapi_volume_workers_max: 16
cinder_osapi_volume_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, cinder_osapi_volume_workers_max] | min }}"
cinder_osapi_volume_workers: >-
{{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, cinder_osapi_volume_workers_max] | min }}
## Cinder iscsi
cinder_target_helper_mapping:
@ -290,9 +300,9 @@ cinder_quota_backup_gigabytes: 1000
cinder_lvm_devices_filter_override: []
# cinder_backend_lvm_inuse: True if current host has an lvm backend
cinder_backend_lvm_inuse: '{{ (cinder_backends|default("")|to_json).find("lvm") != -1 }}'
cinder_backend_lvm_inuse: '{{ (cinder_backends | default("") | to_json).find("lvm") != -1 }}'
# cinder_backend_rbd_inuse: True if the current host has an rbd backend
cinder_backend_rbd_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}'
cinder_backend_rbd_inuse: '{{ (cinder_backends | default("") | to_json).find("cinder.volume.drivers.rbd.RBDDriver") != -1 }}'
# Set to false if you want to explicitly disable active/active cluster
cinder_active_active_cluster: "{{ cinder_backend_rbd_inuse }}"
@ -301,12 +311,19 @@ cinder_active_active_cluster_name: ceph
## Policy vars
# Provide a list of access controls to merge with the default
# access controls in the service code.
#cinder_policy_overrides:
# "volume:create": ""
# "volume:delete": ""
# cinder_policy_overrides:
# "volume:create": ""
# "volume:delete": ""
# Comma separated list of Glance API servers
cinder_glance_api_servers: "{{ (glance_service_internalurl | default('http://localhost')) | urlsplit('scheme') ~ '://' ~ (glance_service_internalurl | default('http://localhost')) | urlsplit('netloc') }}"
cinder_glance_api_servers: >-
{{
(
glance_service_internalurl | default('http://localhost')
) | urlsplit('scheme') ~ '://' ~ (
glance_service_internalurl | default('http://localhost')
) | urlsplit('netloc')
}}
cinder_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}"
@ -381,7 +398,7 @@ cinder_services:
# Cinder uWSGI settings
cinder_wsgi_processes_max: 16
cinder_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}"
cinder_wsgi_processes: "{{ [[ansible_facts['processor_vcpus'] | default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}"
cinder_wsgi_threads: 1
cinder_uwsgi_tls:
crt: "{{ cinder_ssl_cert }}"
@ -416,8 +433,6 @@ cinder_environment_overrides:
Service:
Environment: "PATH={{ cinder_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
_UUID_regex: "[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}"
cinder_memcached_servers: "{{ memcached_servers }}"
###
@ -465,8 +480,8 @@ cinder_pki_install_certificates:
mode: "0600"
# Define user-provided SSL certificates
#cinder_user_ssl_cert: <path to cert on ansible deployment host>
#cinder_user_ssl_key: <path to cert on ansible deployment host>
# cinder_user_ssl_cert: <path to cert on ansible deployment host>
# cinder_user_ssl_key: <path to cert on ansible deployment host>
# Database cleanup
# Periodically purge shadow tables, where archived records are stored

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Installation and setup of cinder
company: Rackspace
license: Apache2
min_ansible_version: 2.2
role_name: os_cinder
namespace: openstack
min_ansible_version: "2.10"
platforms:
- name: Debian
versions:
- buster
- bullseye
- name: Ubuntu
versions:
- bionic
- focal
- jammy
- name: EL
versions:
- 8
categories:
- "9"
galaxy_tags:
- cloud
- python
- cinder

View File

@ -39,32 +39,42 @@
- name: Add in cinder devices types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ item.key }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
if ! {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ item.key }}"; then
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type create \
--property volume_backend_name="{{ item.value.volume_backend_name }}" \
{% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ item.key }}"
fi
args:
executable: /bin/bash
with_dict: "{{ _cinder_backends|default({}) }}"
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_dict: "{{ _cinder_backends | default({}) }}"
delegate_to: "{{ cinder_service_setup_host }}"
changed_when: false
- name: Add extra cinder volume types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
{% for evtype in item.value.extra_volume_types %}
if ! {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type create --property volume_backend_name="{{ item.value.volume_backend_name }}" {% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ evtype }}"
if ! {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ evtype }}"; then
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type create \
--property volume_backend_name="{{ item.value.volume_backend_name }}" \
{% if not (item.value.public | default(True)) | bool %} --private {% endif %} "{{ evtype }}"
fi
{% endfor %}
args:
executable: /bin/bash
with_dict: "{{ _cinder_backends|default({}) }}"
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
changed_when: false
with_dict: "{{ _cinder_backends | default({}) }}"
delegate_to: "{{ cinder_service_setup_host }}"
when: item.value.extra_volume_types is defined
- import_tasks: cinder_qos.yml
- name: Importing cinder_qos tasks
import_tasks: cinder_qos.yml
when: cinder_qos_specs is defined
tags:
- cinder-qos

View File

@ -22,8 +22,9 @@
section: cinder
option: "need_db_sync"
state: absent
mode: "0644"
- name: refresh local facts
- name: Refresh local facts
setup:
filter: ansible_local
gather_subset: "!all"

View File

@ -29,6 +29,7 @@
- name: Check if all cinder services are up
shell: "{{ cinder_bin }}/cinder-manage service list | /usr/bin/awk '{ if(NR>1) print $5 }' | /bin/egrep -vq ':-)'"
register: failed_cinder_services
changed_when: false
ignore_errors: True
- name: Fail if any cinder service is down
@ -53,6 +54,7 @@
section: cinder
option: need_online_data_migrations
value: False
mode: "0644"
with_items: "{{ groups[cinder_services['cinder-api']['group']] }}"
when:
- not data_migrations is skipped

View File

@ -19,6 +19,7 @@
section: "cinder"
option: "install_method"
value: "{{ cinder_install_method }}"
mode: "0644"
- name: Refresh local facts to ensure the cinder section is present
setup:
@ -51,10 +52,10 @@
systemd_tempd_prefix: openstack
systemd_slice_name: "{{ cinder_system_slice_name }}"
systemd_lock_dir: "{{ cinder_lock_dir }}"
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_service_cpu_accounting: true
systemd_service_block_io_accounting: true
systemd_service_memory_accounting: true
systemd_service_tasks_accounting: true
systemd_services: "{{ filtered_cinder_services }}"
tags:
- cinder-config
@ -69,6 +70,7 @@
section: cinder
option: venv_tag
value: "{{ cinder_venv_tag }}"
mode: "0644"
- name: Set the upgrade facts
ini_file:
@ -76,10 +78,11 @@
section: cinder
option: "{{ item }}"
value: true
mode: "0644"
with_items:
- "need_online_data_migrations"
- "need_service_restart"
when:
(install_packages is changed) or
('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or
('need_service_restart' not in ansible_local['openstack_ansible']['cinder'])
- (install_packages is changed) or
('need_online_data_migrations' not in ansible_local['openstack_ansible']['cinder']) or
('need_service_restart' not in ansible_local['openstack_ansible']['cinder'])

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Discover lvm devices
shell: |
shell: >-
/sbin/pvdisplay | awk '/PV\ Name/ {print $3}' | sed 's/\/dev\///g'
register: lvm_devices
changed_when: lvm_devices.rc != 0
@ -24,6 +24,7 @@
file:
state: "directory"
path: "/etc/lvm"
mode: "0755"
when: lvm_devices.rc == 0
- name: Drop lvm Config
@ -33,4 +34,5 @@
owner: "root"
group: "root"
backup: "yes"
mode: "0644"
when: lvm_devices.rc == 0

View File

@ -21,6 +21,7 @@
state: "directory"
owner: "root"
group: "root"
mode: "0750"
- name: Generate cinder config
openstack.config_template.config_template:
@ -45,7 +46,7 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "{{ item.group|default(cinder_system_group_name) }}"
group: "{{ item.group | default(cinder_system_group_name) }}"
mode: "0640"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
@ -160,6 +161,7 @@
template:
src: nfs_shares.j2
dest: "{{ item.value.nfs_shares_config }}"
mode: "0644"
with_dict: "{{ cinder_backends | default({}) }}"
when:
- "cinder_services['cinder-volume']['group'] in group_names"

View File

@ -13,17 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: create the system group
- name: Create the system group
group:
name: "{{ cinder_system_group_name }}"
gid: "{{ cinder_system_group_gid|default(omit) }}"
gid: "{{ cinder_system_group_gid | default(omit) }}"
state: "present"
system: "yes"
- name: Create the cinder system user
user:
name: "{{ cinder_system_user_name }}"
uid: "{{ cinder_system_user_uid|default(omit) }}"
uid: "{{ cinder_system_user_uid | default(omit) }}"
group: "{{ cinder_system_group_name }}"
comment: "{{ cinder_system_comment }}"
shell: "{{ cinder_system_shell }}"

View File

@ -16,13 +16,15 @@
- name: Add in cinder qos types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos list --format value --column Name | grep -x {{ item.name }} || \
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos create {{ item.name }} \
--consumer {{ item.options.consumer }}\
{% for k,v in item.options.items() %} --property {{ k }}={{ v }}{% endfor %}
{% for k, v in item.options.items() %} --property {{ k }}={{ v }}{% endfor %}
args:
executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}"
delegate_to: "{{ cinder_service_setup_host }}"
changed_when: false
@ -32,15 +34,18 @@
- name: Associate qos types to volume types
shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
CLI_OPTIONS="{{ ((keystone_service_adminuri_insecure | bool) or (keystone_service_internaluri_insecure | bool)) | ternary('--insecure', '') }}"
{% for vtype in item.cinder_volume_types %}
if {{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then
{{ cinder_service_setup_host_python_interpreter | dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }}
if {{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume type show "{{ vtype }}"; then
{{ __cinder_python_interpreter_dirname }}/openstack ${CLI_OPTIONS} volume qos associate {{ item.name }} {{ vtype }}
fi
{% endfor %}
args:
executable: /bin/bash
vars:
__cinder_python_interpreter_dirname: "{{ cinder_service_setup_host_python_interpreter | dirname }}"
with_items: "{{ cinder_qos_specs }}"
changed_when: false
delegate_to: "{{ cinder_service_setup_host }}"
when:
- item.cinder_volume_types is defined

View File

@ -43,7 +43,8 @@
tags:
- always
- include_role:
- name: Including osa.db_setup role
include_role:
name: openstack.osa.db_setup
apply:
tags:
@ -64,7 +65,8 @@
tags:
- always
- include_role:
- name: Including osa.mq_setup role
include_role:
name: openstack.osa.mq_setup
apply:
tags:
@ -86,18 +88,21 @@
tags:
- always
- import_tasks: cinder_lvm_config.yml
- name: Importing cinder_lvm_config tasks
import_tasks: cinder_lvm_config.yml
when:
- "cinder_services['cinder-volume']['group'] in group_names"
- "cinder_backend_lvm_inuse | bool"
tags:
- cinder-config
- import_tasks: cinder_pre_install.yml
- name: Importing cinder_pre_install tasks
import_tasks: cinder_pre_install.yml
tags:
- cinder-install
- import_tasks: cinder_install.yml
- name: Importing cinder_install tasks
import_tasks: cinder_install.yml
tags:
- cinder-install
@ -121,14 +126,15 @@
tags:
- always
- name: refresh local facts
- name: Refresh local facts
setup:
filter: ansible_local
gather_subset: "!all"
tags:
- cinder-config
- include_tasks: cinder_cleanup_old_facts.yml
- name: Including cinder_cleanup_old_facts tasks
include_tasks: cinder_cleanup_old_facts.yml
args:
apply:
tags:
@ -140,7 +146,8 @@
tags:
- always
- import_tasks: cinder_post_install.yml
- name: Importing cinder_post_install tasks
import_tasks: cinder_post_install.yml
tags:
- cinder-config
@ -155,17 +162,22 @@
systemd_services:
- service_name: "cinder-volume-usage-audit"
execstarts:
- '/bin/bash -c "{{ cinder_bin }}/cinder-volume-usage-audit --start_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00\s-d\s-1{{ cinder_volume_usage_audit }})\" --end_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00)\" {{ (cinder_volume_usage_audit_send_actions_enabled | bool) | ternary( "--send_actions", "--nosend_actions" ) }}"'
- >-
/bin/bash -c "{{ cinder_bin }}/cinder-volume-usage-audit --start_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00\s-d\s-1{{ cinder_volume_usage_audit }})\"
--end_time \"$$(date\s+%%Y-%%m-%%d\\\s%%H:00:00)\" {{
(cinder_volume_usage_audit_send_actions_enabled | bool) | ternary('--send_actions', '--nosend_actions')
}}"
timer:
state: "{{ ((cinder_services['cinder-volume']['group'] in group_names) and (cinder_ceilometer_enabled | bool)) | ternary('started', 'stopped') }}"
options:
OnBootSec: 30min
OnCalendar: "{{ (cinder_volume_usage_audit == 'day') | ternary('daily', cinder_volume_usage_audit+'ly') }}"
OnCalendar: "{{ (cinder_volume_usage_audit == 'day') | ternary('daily', cinder_volume_usage_audit + 'ly') }}"
Persistent: true
tags:
- cinder-config
- import_tasks: cinder_db_sync.yml
- name: Importing cinder_db_sync tasks
import_tasks: cinder_db_sync.yml
when:
- _cinder_is_first_api_play_host
tags:
@ -181,7 +193,8 @@
- cinder-config
- uwsgi
- include_role:
- name: Including osa.service_setup role
include_role:
name: openstack.osa.service_setup
apply:
tags:
@ -231,18 +244,20 @@
retries: 5
delay: 2
when:
- "cinder_services['cinder-volume']['group'] in group_names"
- "cinder_services['cinder-volume']['group'] in group_names"
- name: Flush handlers
meta: flush_handlers
- import_tasks: cinder_db_post_setup.yml
- name: Importing cinder_db_post_setup tasks
import_tasks: cinder_db_post_setup.yml
when:
- "_cinder_is_last_play_host"
tags:
- cinder-config
- import_tasks: cinder_backends.yml
- name: Importing cinder_backends tasks
import_tasks: cinder_backends.yml
when:
- "groups[cinder_services['cinder-volume']['group']] | length > 0"
- "_cinder_is_last_play_host"

View File

@ -13,9 +13,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_cinder_is_first_api_play_host: "{{ (cinder_services['cinder-api']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
_cinder_is_first_play_host: "{{ (cinder_services['cinder-scheduler']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-scheduler']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
_cinder_is_last_play_host: "{{ (cinder_services['cinder-api']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | last) | bool }}"
_cinder_is_first_api_play_host: >-
{{
(cinder_services['cinder-api']['group'] in group_names and
inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_cinder_is_first_play_host: >-
{{
(cinder_services['cinder-scheduler']['group'] in group_names and
inventory_hostname == (groups[cinder_services['cinder-scheduler']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_cinder_is_last_play_host: >-
{{
(cinder_services['cinder-api']['group'] in group_names and
inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | last) | bool
}}
_cinder_rootwrap_conf_overrides:
DEFAULT:
@ -136,4 +148,6 @@ _cinder_coordination_url: >-
groups[cinder_coordination_group]
| map('extract', hostvars, 'ansible_host')
| list | join(':' ~ cinder_coordination_port ~ ',')
}}:{{ cinder_coordination_port }}?namespace={{ cinder_coordination_namespace }}{% if cinder_coordination_client_ssl | bool %}&use_ssl=True&verify_certs={{ cinder_coordination_verify_cert | bool }}{% endif %}
}}:{{ cinder_coordination_port -}}
?namespace={{ cinder_coordination_namespace }}{% if cinder_coordination_client_ssl | bool -%}
&use_ssl=True&verify_certs={{ cinder_coordination_verify_cert | bool }}{% endif %}