Move the snapshots feature to optional/beta

Previously a commit[1] introduced a new way of doing backup, using
"snapshots", that do not require to bring down the whole controller to
take the backup. On that commit, the old way was removed, which do not
follow the deprecation procedure.

This commits reintroduces the old way of performing backups via stopping
the controllers and move the snapshots feature to an optional,
user-selected feature.

Due to some other changes that arrived to the branch after this one,
this was not a clean commit and some manual conflict resolution was
needed.

[1] https://review.opendev.org/c/openstack/tripleo-ansible/+/786380

(cherry picked from commit 00a17ffb4a)
Change-Id: I49944d585825b32052278cd865a74c46dcb5eaa4
(cherry picked from commit 2b56b7f933)
This commit is contained in:
Juan Larriba 2021-05-07 12:02:30 +02:00
parent 496e73cb23
commit 091dd3fbb9
6 changed files with 54 additions and 26 deletions

View File

@ -24,6 +24,10 @@ tripleo_container_cli: "{{ container_cli | default('podman') }}"
# Stop and start all running services before backup is ran.
tripleo_backup_and_restore_service_manager: true
# If this is false, backup of the overcloud is taken by stopping it completely. Enable it to do a
# backup stopping only one node at a time, maintaining the controller active during the backup duration.
tripleo_backup_and_restore_enable_snapshots: true
# Set the name of the mysql container
tripleo_backup_and_restore_mysql_container: mysql

View File

@ -22,5 +22,4 @@
- role: backup_and_restore
tripleo_backup_and_restore_nfs_server: localhost
tripleo_backup_and_restore_rear_simulate: true
tripleo_backup_and_restore_service_manager: false
tripleo_backup_and_restore_hiera_config_file: "{{ ansible_user_dir }}/hiera.yaml"

View File

@ -53,6 +53,7 @@
when:
- enabled_galera
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
run_once: true
tags:
- bar_create_recover_image
@ -68,6 +69,7 @@
when:
- enabled_galera
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
tags:
- bar_create_recover_image
@ -132,6 +134,7 @@
- tripleo_backup_and_restore_mysql_container == "mysql"
- not enabled_galera
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
tags:
- bar_create_recover_image
@ -140,6 +143,7 @@
when:
- enabled_galera
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
run_once: true
tags:
- bar_create_recover_image

View File

@ -41,7 +41,8 @@
- name: Service management
import_tasks: service_manager_pause.yml
when:
- tripleo_backup_and_restore_service_manager
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
- name: Backup the database
import_tasks: db_backup.yml
@ -58,8 +59,10 @@
import_tasks: service_manager_unpause.yml
when:
- tripleo_backup_and_restore_service_manager|bool
- not tripleo_backup_and_restore_enable_snapshots|bool
- name: Service management
import_tasks: service_manager_unpause.yml
when:
- tripleo_backup_and_restore_service_manager
- name: Pacemaker management
import_tasks: pacemaker_unstandby.yml
when:
- pacemaker_enabled
- tripleo_backup_and_restore_enable_snapshots|bool

View File

@ -0,0 +1,30 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start again pacemaker
- name: Add the node to the pacemaker cluster
command: pcs node unstandby
tags:
- bar_create_recover_image
- name: Wait until pacemaker has Galera up&running
shell: ss -tunlp | grep ":3306 " | sed -e 's/.*\///'
register: mysql_result
retries: 300
until: mysql_result is search('mysqld')
delay: 5
tags:
- bar_create_recover_image

View File

@ -32,6 +32,14 @@
tags:
- always
- name: Take this node out of pacemaker
command: pcs node standby
when:
- pacemaker_enabled
- tripleo_backup_and_restore_enable_snapshots|bool
tags:
- bar_create_recover_image
- name: Create the node backup
become: true
command: rear {{ '-s ' if tripleo_backup_and_restore_rear_simulate else '' }}-d -v mkbackup
@ -46,26 +54,6 @@
tags:
- bar_create_recover_image
- name: Add the node to the pacemaker cluster
command: pcs node unstandby
when:
- pacemaker_enabled
- tripleo_backup_and_restore_enable_snapshots|bool
tags:
- bar_create_recover_image
- name: Wait until pacemaker has Galera up&running
shell: netstat -tunlp | grep ":3306 " | sed -e 's/.*\///'
register: mysql_result
retries: 10
until: mysql_result is search('mysqld')
delay: 5
when:
- pacemaker_enabled
- tripleo_backup_and_restore_enable_snapshots|bool
tags:
- bar_create_recover_image
- name: Clean old backups
shell: |
set -o pipefail