Rename backup user images parameter

This commit will rename the old backup_user_local_registry backup
parameter to backup_user_images in order to clarify the meaning of this
operation for the users. Also, the default naming of the backup files
generated will follow the same naming pattern.

TEST PLAN
PASS Backup with new option, check if the user images backup was
     taken properly

Story: 2010117
Task: 46410
Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: Id77f0bf55899a12888f6dfba81ba3fa732f5ab03
This commit is contained in:
Thiago Brito
2022-09-26 13:09:09 -03:00
committed by Thiago Paiva Brito
parent 711e06512d
commit f0b3c6cb71
6 changed files with 16 additions and 16 deletions

View File

@@ -23,6 +23,6 @@
vault_pass: "{{ ansible_become_pass|list|shuffle|join }}"
vault_id_file: "/tmp/vaultid_{{ inventory_hostname }}.tmp"
default_backup_prefix: "{{ inventory_hostname }}_platform_backup"
default_registry_backup_prefix: "{{ inventory_hostname }}_docker_local_registry_backup"
default_user_images_backup_prefix: "{{ inventory_hostname }}_user_images_backup"
default_local_backup_dir: "/opt/platform-backup/backups"
default_local_staging_dir: "/opt/backups/{{ inventory_hostname|list|reverse|join }}"

View File

@@ -63,9 +63,9 @@ target_backup_dir: /opt/platform-backup
platform_backup_filename_prefix: "{{ inventory_hostname }}_platform_backup"
# The local registry images backup tarball will be named in this format:
# <docker_local_registry_backup_filename_prefix>_<timestamp>.tgz
# <user_images_backup_filename_prefix>_<timestamp>.tgz
#
docker_local_registry_backup_filename_prefix: "{{ inventory_hostname }}_docker_local_registry_backup"
user_images_backup_filename_prefix: "{{ inventory_hostname }}_user_images_backup"
# The local image registry filesystem backup tarball will be named in this format:
# <registry_fs_backup_filename_prefix>_<timestamp>.tgz

View File

@@ -15,7 +15,7 @@
# Set parameters for ldap different paths by OS
ldap_schema_path: "{{ '/etc/openldap/schema' if os_release == 'centos' else '/etc/ldap/schema' }}"
backup_registry_filesystem_required: "{{ backup_registry_filesystem | bool }}"
should_use_old_image_backup: "{{ backup_user_local_registry|bool == true }}"
should_use_old_image_backup: "{{ backup_user_images|bool == true }}"
- name: Do StarlingX backup
@@ -513,21 +513,21 @@
- name: Attach timestamp to backups filename
set_fact:
platform_backup_file: "{{ platform_backup_filename_prefix }}_{{ backup_timestamp }}.tgz"
docker_local_registry_backup_file: "{{ docker_local_registry_backup_filename_prefix }}_{{ backup_timestamp }}.tgz"
user_images_backup_file: "{{ user_images_backup_filename_prefix }}_{{ backup_timestamp }}.tgz"
openstack_backup_file: "{{ openstack_backup_filename_prefix }}_{{ backup_timestamp }}.tgz"
dc_vault_backup_file: "{{ dc_vault_backup_filename_prefix }}_{{ backup_timestamp }}.tgz"
- name: Set backup files absolute path
set_fact:
platform_backup_file_path: "{{ backup_dir }}/{{ platform_backup_file }}"
docker_local_registry_backup_file_path: "{{ backup_dir }}/{{ docker_local_registry_backup_file }}"
user_images_backup_file_path: "{{ backup_dir }}/{{ user_images_backup_file }}"
openstack_backup_file_path: "{{ backup_dir }}/{{ openstack_backup_file }}"
dc_vault_backup_file_path: "{{ backup_dir }}/{{ dc_vault_backup_file }}"
- name: Save user uploaded images from local registry to an archive
include_tasks: export-user-local-registry-images.yml
vars:
export_file_path: "{{ docker_local_registry_backup_file_path }}"
export_file_path: "{{ user_images_backup_file_path }}"
kilo_free_size: "{{ remaining_disk_size_estimation }}"
when: should_use_old_image_backup

View File

@@ -12,7 +12,7 @@ skip_os_dbs:
mariadb_pod: mariadb-server-0
backup_user_local_registry: false
backup_user_images: false
# By default, all of /etc will be backed up
optimize_etc_backup: false

View File

@@ -8,10 +8,10 @@
- name: Check if image backup options are defined and mutually exclusive
fail:
msg: >-
The options backup_user_local_registry and backup_registry_filesystem cannot be used at
The options backup_user_images and backup_registry_filesystem cannot be used at
the same time
when: >
backup_user_local_registry is defined and
backup_user_images is defined and
backup_registry_filesystem is defined and
backup_user_local_registry|bool and
backup_user_images|bool and
backup_registry_filesystem|bool

View File

@@ -14,12 +14,12 @@
when: item.key is undefined or item.value|type_debug != 'bool'
loop:
- { key: local, value: "{{ local }}" }
- { key: backup_user_local_registry, value: "{{ backup_user_local_registry }}" }
- { key: backup_user_images, value: "{{ backup_user_images }}" }
- name: Fail if custom images backup is requested for centralized backup
fail:
msg: "Custom images backup is not supported for centralized backup request."
when: not local and backup_user_local_registry
when: not local and backup_user_images
- name: Fail if storage location is not specified for centralized backup
fail:
@@ -62,15 +62,15 @@
- name: Set registry backup filename prefix in backup overrides file
lineinfile:
path: "{{ backup_overrides }}"
line: "docker_local_registry_backup_filename_prefix: {{ default_registry_backup_prefix }}"
line: "user_images_backup_filename_prefix: {{ default_user_images_backup_prefix }}"
# become: yes
connection: local
- name: Set registry backup filename prefix fact
set_fact:
docker_local_registry_backup_filename_prefix: "{{ default_registry_backup_prefix }}"
user_images_backup_filename_prefix: "{{ default_user_images_backup_prefix }}"
when: docker_local_registry_backup_filename_prefix is undefined
when: user_images_backup_filename_prefix is undefined
- name: Retrieve software version number
shell: source /etc/build.info; echo $SW_VERSION