Merge "[B&R] More robust check on Galera desync the MySQL node"

This commit is contained in:
Zuul 2022-07-04 16:18:26 +00:00 committed by Gerrit Code Review
commit ffdff45839
5 changed files with 15 additions and 14 deletions

View File

@ -22,6 +22,7 @@ tripleo_controller_group_name: "{{ controller_group_name | default('Controller')
# Set the container command line entry-point
tripleo_container_cli: "{{ container_cli | default('podman') }}"
tripleo_container_cli_flags: ""
# Stop and start all running services before backup is ran.
tripleo_backup_and_restore_service_manager: true

View File

@ -55,13 +55,13 @@
tags: bar_create_recover_image
block:
- name: Ensure cephmon container is running
command: "{{ tripleo_container_cli }} unpause ceph-mon-{{ inventory_hostname }}"
command: "{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} unpause ceph-mon-{{ inventory_hostname }}"
failed_when: false
- name: Export ceph authentication
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec ceph-mon-{{ inventory_hostname }} \
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec ceph-mon-{{ inventory_hostname }} \
bash -c "ceph --cluster {{ tripleo_backup_and_restore_ceph_cluster | default('ceph') }} auth export"
register: bar_ceph_authentication_content

View File

@ -35,7 +35,7 @@
- name: Check ceph rgw presence
shell: |
set -o pipefail
{{ tripleo_container_cli }} ps -a | grep ceph-rgw | wc -l
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} ps -a | grep ceph-rgw | wc -l
register: bar_ceph_rgw_exits
ignore_errors: true
tags:

View File

@ -80,7 +80,7 @@
- name: Get the mysql container id when galera is enabled
shell: |
set -o pipefail
{{ tripleo_container_cli }} ps -q --filter='name=galera'
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} ps -q --filter='name=galera'
when: enabled_galera
register: galera_container_id
tags:
@ -94,7 +94,7 @@
- bar_create_recover_image
- name: Ensure mysql container is running
command: "{{ tripleo_container_cli }} unpause {{ tripleo_backup_and_restore_mysql_container }}"
command: "{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} unpause {{ tripleo_backup_and_restore_mysql_container }}"
when:
- mysql_password.stderr is defined
- tripleo_backup_and_restore_mysql_container == "mysql"
@ -107,7 +107,7 @@
- name: Galera desync the MySQL node
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
-p{{ mysql_password.stdout }} --execute 'SET GLOBAL wsrep_desync = ON'"
register: desync_output
retries: 300
@ -124,7 +124,7 @@
- name: MySQL BBDDs backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysqldump -uroot -p{{ mysql_password.stdout }} --opt --all-databases" > {{ tripleo_backup_and_restore_mysql_backup_file }}
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysqldump -uroot -p{{ mysql_password.stdout }} --opt --all-databases" > {{ tripleo_backup_and_restore_mysql_backup_file }}
when:
- mysql_password.stderr is defined
- not enabled_galera
@ -135,7 +135,7 @@
- name: Galera Grants backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
-p{{ mysql_password.stdout }} -s -N \
-e \"SELECT CONCAT('\\\"SHOW GRANTS FOR ''',user,'''@''',host,''';\\\"') \
FROM mysql.user where (length(user) > 0 and \
@ -151,7 +151,7 @@
- name: Galera BBDDs backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
-p{{ mysql_password.stdout }} -s -N \
-e \"select distinct table_schema from information_schema.tables \
where engine='innodb' and table_schema != 'mysql';\" | xargs mysqldump -uroot \
@ -166,7 +166,7 @@
- name: Galera sync the MySQL node
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -p -u root \
-p{{ mysql_password.stdout }} --execute 'SET GLOBAL wsrep_desync = OFF'"
when:
- mysql_password.stderr is defined
@ -177,7 +177,7 @@
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: Pause mysql.
command: "{{ tripleo_container_cli }} pause {{ tripleo_backup_and_restore_mysql_container }}"
command: "{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} pause {{ tripleo_backup_and_restore_mysql_container }}"
when:
- mysql_password.stderr is defined
- tripleo_backup_and_restore_mysql_container == "mysql"

View File

@ -26,7 +26,7 @@
- bar_create_recover_image
- name: unPause database container
command: "{{ tripleo_container_cli }} unpause {{ tripleo_backup_and_restore_mysql_container }}"
command: "{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} unpause {{ tripleo_backup_and_restore_mysql_container }}"
when:
- tripleo_container_cli is defined
- not enabled_galera
@ -37,14 +37,14 @@
- name: Gather Container Service Name
shell: |
set -o pipefail
/usr/bin/{{ tripleo_container_cli }} ps -a --filter='status=paused' --format '{{ '{{' }}.Names {{ '}}' }} '
/usr/bin/{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} ps -a --filter='status=paused' --format '{{ '{{' }}.Names {{ '}}' }} '
register: container_services
changed_when: container_services.stdout is defined
tags:
- bar_create_recover_image
- name: unPause containers
command: "{{ tripleo_container_cli }} unpause {{ item }}"
command: "{{ tripleo_container_cli }} {{ tripleo_container_cli_flags }} unpause {{ item }}"
with_items: "{{ container_services.stdout_lines }}"
when: tripleo_container_cli is defined
tags: