Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2134230

Summary: [RFE] Log pulp3 content migration process
Product: Red Hat Satellite Reporter: Jessica Richards <jrichards2>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: dalley, ehelms, iballou
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-18 04:32:13 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 Jessica Richards 2022-10-12 20:57:29 UTC
1. Proposed title of this feature request

[RFE] Log pulp3 content migration process

2. Who is the customer behind the request?

     Account: red hat (acct #540155)

     TAM customer: no

     CSM customer: no

     Strategic: no

3. What is the nature and description of the request?

I'd like to request that the content migration process be logged somewhere, ideally somewhere that would be picked up by an sosreport.

4. Why does the customer need this? (List the business requirements here)

Content premigration can take a very long time; usually hours, but on rare occasions even days.  The upgrade process also contains a content migration step that can take a long time if content premigration is skipped, or if the customer waits a week or two between premigration and upgrade, or if they've configured a certain workaround to prevent a "Cursor not found" error (KCS 6521251).  During this time, customers frequently ask "how can I see that something is happening?", but we don't have great answers for them.  Because they cannot see much happening on the screen, they often assume (or insist) that nothing is happening, even if it is.

5. How would the customer like to achieve this? (List the functional requirements here)

This foreman-rake script was recently used in a case to monitor the migration task:

# foreman-rake console << EORAKE
namespace :katello do
  task=ForemanTasks::Task.find_by(external_id: '<external_id>')
  wait = ::Foreman::Cast.to_bool(ENV['wait'] || 'true')
  preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
  if wait
    clear_count = nil 
    until !task.pending? || task.paused?
      \$stdout.print("\r#{' ' * clear_count}\r") if clear_count && !preserve_output #clear the line before printing
      \$stdout.print("\n") if preserve_output
      message = "#{Time.now.to_s}: #{task.humanized[:output]}"
      clear_count = message.length + 1 
      \$stdout.print(message)
      \$stdout.flush
  
      sleep(10)
      task = ForemanTasks::Task.find(task.id)
      puts
    end
    if task.result == 'warning' || task.result == 'pending'
      msg = _("Migration failed, You will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}\n")
      \$stderr.print(msg)
      puts
      fail ForemanTasks::TaskError, task
    else
      puts
      Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
        if type.missing_migrated_content.any?
          puts "Some corrupted or missing content found, run 'foreman-maintain content migration-stats' for more information."
          exit(-1)
        end
      end
      puts _("Content Migration completed successfully")
    end
  else
    puts "Migration started, you may monitor it at: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}"
  end
end
EORAKE

Note:  <external_id> must be replaced by the task ID, which is accessible during the content migration, but which is inaccessible during the upgrade (because maintenance mode is automatically enabled during the ugprade process).

The output of the script looks like this:

2022-09-27 18:46:35 -0400: Migrating rpm content to Pulp 3 188999/450904
2022-09-27 18:46:45 -0400: Migrating rpm content to Pulp 3 189079/450904
2022-09-27 18:46:55 -0400: Migrating rpm content to Pulp 3 189079/450904
2022-09-27 18:47:05 -0400: Migrating rpm content to Pulp 3 189303/450904


It would be ideal if these outputs were appended to a log file in /var/log/foreman-maintain so that we could see the progress of each migration/upgrade attempt.


6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

- install satellite 6.9
- synchronize a couple of RHEL repositories
- upgrade to satellite 6.10
- tail the log
- run an sosreport
- extract the sosreport to verify that the file is contained therein

7. Is there already an existing RFE upstream or in Red Hat Bugzilla?

no

8. Does the customer have any specific time-line dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

no

9. Is the sales team involved in this request and do they have any additional input?

no

10. List any affected packages or components.

satellite-maintain

11. Would the customer be able to assist in testing this functionality if implemented?

yes

Comment 2 Red Hat Bugzilla 2024-01-17 04:25:21 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days