Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2120982

Summary: [OSP16.2] openstack undercloud backup --db-only doesn't work
Product: Red Hat OpenStack Reporter: ggrimaux
Component: tripleo-ansibleAssignee: Fernando Díaz <fdiazbra>
Status: CLOSED ERRATA QA Contact: Khomesh Thakre <kthakre>
Severity: high Docs Contact:
Priority: high    
Version: 16.2 (Train)CC: fdiazbra, jbadiapa, jschluet, kthakre
Target Milestone: z4Keywords: Triaged
Target Release: 16.2 (Train on RHEL 8.4)Flags: fdiazbra: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tripleo-ansible-0.8.1-2.20220519104847.e07eeb9.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-07 19:24:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ggrimaux 2022-08-24 08:43:25 UTC
Description of problem:
This has been reproduced in client's environment and in our lab (16.2.3)

In our doc [1] it says you can run this command to make a database backup:
openstack undercloud backup --db-only

[1]
https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.2/html-single/backing_up_and_restoring_the_undercloud_and_control_plane_nodes/index#proc_creating-a-database-backup-of-the-undercloud-node_backup-undercloud

But if you run this you get the following error:
~~~
$ openstack undercloud backup --db-only
Using /tmp/cli-undercloud-db-backup.yaml2olv_s46ansible.cfg as config file

PLAY [TripleO Undercloud DB backup.] *********************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
[WARNING]: log file at /usr/share/ansible/tripleo-playbooks/ansible.log is not writeable and we cannot create it, aborting

ok: [undercloud]

TASK [Create DB Backup for the undercloud] ***************************************************************************************************************************************************************************************************
ERROR! the role 'backup_and_restore' was not found in /usr/share/ansible/tripleo-playbooks/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/usr/share/ansible/roles:/usr/share/openstack-tripleo-validations/roles:/usr/share/ansible/tripleo-playbooks

The error appears to be in '/usr/share/ansible/tripleo-playbooks/cli-undercloud-db-backup.yaml': line 27, column 15, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      include_role:
        name: backup_and_restore
              ^ here

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
undercloud                 : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
~~~

So the error is:
ERROR! the role 'backup_and_restore' was not found in /usr/share/ansible/tripleo-playbooks/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/usr/share/ansible/roles:/usr/share/openstack-tripleo-validations/roles:/usr/share/ansible/tripleo-playbooks

It says it can't find the role backup_and_restore in all those paths.
But in /usr/share/ansible/roles the role is there:
~~~
[root@undercloud-0 ~]# ls /usr/share/ansible/roles|grep backup
backup-and-restore
~~~

Noticed the difference between backup_and_restore and backup-and-restore ?

What if we rename this DIR with underscore instead.

Then we got this error message (Progress!):
TASK [Create DB Backup for the undercloud] **************************************************************************************************************************************************
ERROR! Could not find specified file in role: tasks/db_backup.yml

So a task is missing.

Found a task with the same name so why not copy it under this backup_and_restore role:
~~~
cp /usr/share/ansible/roles/backup_and_restore/backup/tasks/db_backup.yml /usr/share/ansible/roles/backup_and_restore/tasks/db_backup.yml
~~~

And now we have a backup:
~~~
TASK [Gathering Facts] **********************************************************************************************************************************************************************
[WARNING]: log file at /usr/share/ansible/tripleo-playbooks/ansible.log is not writeable and we cannot create it, aborting

ok: [undercloud]

TASK [Create DB Backup for the undercloud] **************************************************************************************************************************************************

TASK [backup_and_restore : Get database root password] **************************************************************************************************************************************
changed: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": true}

TASK [backup_and_restore : Get galera bind_address] *****************************************************************************************************************************************
changed: [undercloud] => {"changed": true, "cmd": ["hiera", "-c", "/etc/puppet/hiera.yaml", "tripleo::profile::pacemaker::database::mysql::bind_address"], "delta": "0:00:00.169028", "end": "2022-08-23 12:21:47.587468", "rc": 0, "start": "2022-08-23 12:21:47.418440", "stderr": "", "stderr_lines": [], "stdout": "nil", "stdout_lines": ["nil"]}

TASK [backup_and_restore : Disable galera when there is no pacemaker mysql bind address] ****************************************************************************************************
ok: [undercloud] => {"ansible_facts": {"enabled_galera": false}, "changed": false}

TASK [backup_and_restore : Enable galera when there is pacemaker mysql bind address] ********************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Ensure pacemaker is running] *************************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Ensure the node is back into the cluster] ************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Wait until pacemaker has Galera up&running] **********************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Get the mysql container id when galera is enabled] ***************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [Set the tripleo_backup_and_restore_mysql_container id] ********************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Ensure mysql container is running] *******************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Galera desync the MySQL node] ************************************************************************************************************************************
skipping: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

TASK [backup_and_restore : MySQL Grants backup] *********************************************************************************************************************************************
changed: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": true}

TASK [backup_and_restore : MySQL BBDDs backup] **********************************************************************************************************************************************
changed: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": true}

TASK [backup_and_restore : Galera sync the MySQL node] **************************************************************************************************************************************
skipping: [undercloud] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

TASK [backup_and_restore : Pause mysql.] ****************************************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [backup_and_restore : Stop pacemaker] **************************************************************************************************************************************************
skipping: [undercloud] => {"changed": false, "skip_reason": "Conditional result was False"}

PLAY RECAP **********************************************************************************************************************************************************************************
undercloud                 : ok=6    changed=4    unreachable=0    failed=0    skipped=11   rescued=0    ignored=0



(undercloud) [stack@undercloud-0 ~]$ ll |grep openstack-backup
-rw-r--r--. 1 root  root    68146747 Aug 23 12:21 openstack-backup-mysql-2022-08-23_12_21_50.sql
-rw-r--r--. 1 root  root        6291 Aug 23 12:21 openstack-backup-mysql-grants-2022-08-23_12_21_48.sql
~~~


Upstream in train the role is backup-and-restore:
https://opendev.org/openstack/tripleo-ansible/src/branch/stable/train/tripleo_ansible/roles/backup-and-restore

And the task is not there:
https://opendev.org/openstack/tripleo-ansible/src/branch/stable/train/tripleo_ansible/roles/backup-and-restore/tasks

But in master its backup_and_master:
https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/roles/backup_and_restore

And the task is there:
https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/roles/backup_and_restore/tasks/db_backup.yml




Version-Release number of selected component (if applicable):
OSP 16.2.3

How reproducible:
100%

Steps to Reproduce:
1. Run 'openstack undercloud backup --db-only' on the undercloud node.
2.
3.

Actual results:
Backup isn't done

Expected results:
Backup to succeed

Additional info:

Comment 1 Fernando Díaz 2022-08-24 11:45:23 UTC
This bug was already solved here: https://review.opendev.org/c/openstack/tripleo-ansible/+/836836

Comment 13 errata-xmlrpc 2022-12-07 19:24:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 16.2.4), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8794