Bug 1889856 - Satellite Snapshot Backup Fails Erroneously if File Exists in Backup Directory
Summary: Satellite Snapshot Backup Fails Erroneously if File Exists in Backup Directory
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Suraj Patil
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-20 17:33 UTC by myoder
Modified: 2024-04-16 13:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-04-16 13:10:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 31340 0 Normal Ready For Testing Satellite Snapshot Backup Fails Erroneously if File Exists in Backup Directory 2020-12-16 19:22:45 UTC
Red Hat Issue Tracker SAT-24591 0 None None None 2024-04-16 13:14:10 UTC

Description myoder 2020-10-20 17:33:00 UTC
Description of problem:

While using the "foreman-maintain backup snapshot" command, if any file exists in the /var/snap/pgsql/ directory, the backup script thinks the pgsql snapshot has already been mounted.  And later fails saying it isn't mounted.

The code from this script:

"/usr/share/gems/gems/foreman_maintain-0.5.4/definitions/procedures/backup/snapshot/mount_candlepin_db.rb"

Shows we only check if the directory is empty.  If it is not, we assume the Postgres snapshot has been mounted:

     35         if directory_empty?(mount_point)
     36           with_spinner('Creating snapshot of Postgres') do |spinner|
     37             lv_info = get_lv_info(feature(:candlepin_database).data_dir)
     38             create_lv_snapshot('pgsql-snap', @block_size, lv_info[0])
     39             spinner.update("Mounting snapshot of Postgres on #{mount_point}")
     40             mount_snapshot('pgsql', lv_info[1])
     41           end
     42         else
     43           puts 'Snapshot of Postgres is already mounted'
     44         end


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

How reproducible:
always

Steps to Reproduce:
1. Run a "foreman-maintain backup snapshot" (which creates the snap and pgsql directories from /var/snap/pgsql)
2. After backup finishes successfully, the /var/snap/pgsql directory should be unmounted, and therefore empty.  Now we can create a file "touch /var/snap/pgsql/file.txt"
3. Run the backup script again.

Actual results:
Script says both snapshots are mounted:

--------------------------------------------------------------------------------
Create and mount snapshot of Candlepin DB: 
Snapshot of Postgres is already mounted                               [OK]
--------------------------------------------------------------------------------
Create and mount snapshot of Foreman DB: 
Snapshot of Postgres is already mounted                               [OK]
--------------------------------------------------------------------------------

But later fails saying they are not mounted:
--------------------------------------------------------------------------------
Backup Candlepin DB offline:                                          [FAIL]
Snapshot of Candlepin DB was not found mounted in /var/snap/pgsql
--------------------------------------------------------------------------------

Expected results:
Backup script should check further than just diretory_empty? method.  We should see if the snapshot is actually mounted or not.  Then we can error out with the correct error message (or try to mount over top of the current filesystem if that is permissible).

Additional info:

Comment 1 Suraj Patil 2020-11-19 10:22:20 UTC
Created redmine issue https://projects.theforeman.org/issues/31340 from this bug

Comment 5 Bryan Kearney 2022-05-12 08:02:43 UTC
Upstream bug assigned to supatil

Comment 6 Bryan Kearney 2022-05-12 08:02:45 UTC
Upstream bug assigned to supatil

Comment 7 Eric Helms 2024-04-16 13:10:00 UTC
Satellite Snapshot backup was deprecated in Satellite 6.14 and we do not intend to fix this issues given it will be subsequently removed.


Note You need to log in before you can comment on or make changes to this bug.