Bug 1615077

Summary: Undercloud backup/restore new command and Swift file name/container.
Product: Red Hat OpenStack Reporter: Tzach Shefi <tshefi>
Component: documentationAssignee: RHOS Documentation Team <rhos-docs>
Status: CLOSED EOL QA Contact: RHOS Documentation Team <rhos-docs>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 14.0 (Rocky)CC: dcadzow, dmacpher, srevivo, tshefi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-08 13:28:05 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 Tzach Shefi 2018-08-12 06:07:18 UTC
Description of problem: While testing undercloud backup/restore[0] on this sub step:
1.3. Backing up the underclou, sub step 3 -> 
Archive the database backup and the configuration files:

# sudo tar --xattrs --ignore-failed-read -cf \
    undercloud-backup-`date +%F`.tar \
    /root/undercloud-all-databases.sql \
    /etc \
    /var/log \
    /var/lib/glance \
    /var/lib/certmonger \
    /var/lib/docker \
    /var/lib/registry \
    /srv/node \
    /root \
    /home/stack

This has command has been replaced with a new command if I understand correct -> 
openstack undercloud backup ..


If I'm correct please update guide to reflect this change. 

Also the output of new backup command is created/uploaded to Swift.
This backup file is later the one you need to download/reuse in case of restore. 
I don't yet know the file name/path but this is also very important to add on guide. How to get/download move this file once it's needed in case of restore. 
 

[0]
https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/13/html/back_up_and_restore_the_director_undercloud/


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Tzach Shefi 2018-08-12 12:24:05 UTC
Later on the restore command 
2.1. Restoring the undercloud

13. Synchronize the following directories with backup content:
From the looks of it assumes files are/should have been already un-tarred, probably was correct before new backup command. As when I run first rsycn command it fails.


sudo rsync -a -X /var/tmp/undercloud_backup/home/stack/ /home/stack
rsync: change_dir "/var/tmp/undercloud_backup/home/stack" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]


Having downloaded from Swift on source UC and scp/untragging UC-backup-20180812014025.tar -> 

sudo ls /var/tmp/undercloud_backup/
all-databases-20180812013948.sql.gz  filesystem-20180812013951.tar

sudo tar -xvf filesystem-20180812013951.tar -C filesystem/ --xattrs || true
Now I have all the files and can use rsync.

Comment 2 Tzach Shefi 2018-08-12 12:34:45 UTC
Oh BTW the command I used to figureout/find/download the backup created on source undercloud:

#swift list    (-> lists all containers)
__cache__
ov-hzbw3zdpsb-0-fxrw2qb6gbzn-NovaCompute-3nahouwjjc6w
ov-ixlkdsb2rpv-0-zjgvszg6cgko-Controller-xfsrngelxb5a
overcloud
overcloud-swift-rings
undercloud-backups
undercloud-backups_segments


This ^ I'm not sure who it translates to in unified cli :(


#swift list undercloud-backups   (-> lists files under this container)
UC-backup-20180812014025.tar

Same command in unified cli
#openstack object list undercloud-backups
+------------------------------+
| Name                         |
+------------------------------+
| UC-backup-20180812014025.tar |
+------------------------------+


#swift download undercloud-backups UC-backup-20180812014025.tar
This downloads the backup tar file to your current working dir path. 

#openstack object save undercloud-backups UC-backup-20180812014025.tar
Same command in unified cli

Comment 3 Tzach Shefi 2018-08-13 09:29:38 UTC
2.1 step 20 DB restore, the new new openstack undercloud backup command tars up files and db dump(gz) inside say-> UC-backup-20180812014025.tar

Before we can resotre DB as suggested on step 20: 
Restore the database backup:

[root@director ~]# mysql -u root < /var/tmp/undercloud_backup/root/undercloud-all-databases.sql

undercloud_backup]# ll
total 5497084
-rw-r--r--. 1  989  986   11571658 אוג 12 10:49 all-databases-20180812104955.sql.gz
-rw-r--r--. 1  989  986 5617438720 אוג 12 10:50 filesystem-20180812104959.tar

But then I hit a permissions issues 

mysql -u root < /var/tmp/undercloud_backup/all-databases-20180812104955.sql.gz-bash: /var/tmp/undercloud_backup/all-databases-20180812104955.sql.gz: Permission denied

Running same command with sudo still doesn't work. 

Cloned gz to /home/stack/, worked better yet still not as expected->

mysql -u root < all-databases-20180812104955.sql.gz
ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.

gunzip all-databases-20180812104955.sql.gz fixed issue, import worked. 
So the doc should probably mention to gunzip the dump before trying to restore.

Comment 4 Tzach Shefi 2018-08-13 09:37:44 UTC
this was step 21 -? Restart Mariadb to refresh the permissions from the backup file: [root@director ~]# sudo systemctl restart mariadb

Right afterwords step 1, numbering is wrong should it be 22
Or title missing and it should be step 1? 

Any way this command at step "1" failed

mysql -e 'select host, user, password from mysql.user;'
ERROR 1045 (28000): Access denied for user 'stack'@'localhost' (using password: NO)

Comment 5 Tzach Shefi 2018-08-13 12:09:05 UTC
On source undercloud's root user 
ls -a  -> .my.cnf
create/Copy this file from original undercloud or from file backup/restore.
Save it under same path on new undercloud 
And now this will work -> 
mysql -e 'select host, user, password from mysql.user;'
or if you run it from stack user sudo mysql...

Comment 6 Tzach Shefi 2018-08-13 15:45:28 UTC
FYI managed to restore an undercloud following the guide plus all my workaround described on this bz.

Comment 11 Derek 2019-04-04 01:00:14 UTC
OSP 14 command may be broken - Carlos, can you confirm?

Comment 12 Dan Macpherson 2021-03-08 13:28:05 UTC
OSP14 is EOL and the preferred method for undercloud B&R is to use the ReaR method:

https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html-single/undercloud_and_control_plane_back_up_and_restore/index