Bug #34483
closedThe pulp2-pulp3 migration should fail if not all the errata content has been migrated
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2043933
Description of problem:
Whether manual attempt or via foreman-maintain itself, The "Performing final content migration before switching content" step always succeeds even if some errata content is not migrated and then when "katello:pulp3_content_switchover" happens, It will encounter https://bugzilla.redhat.com/show_bug.cgi?id=2038241 .
Version-Release number of selected component (if applicable):
Katello 3.18
How reproducible:
Always with unmigrated errata
Steps to Reproduce:
1) Run the migration with some yum repositories.
2) Edit the repository errata to have nil erratum_pulp3_hrefs
3) Run the migration again and the switchover
Actual results:
The output of step 2:
- foreman-maintain content migration-stats
Running Retrieve Pulp 2 to Pulp 3 migration statistics ================================================================================
Retrieve Pulp 2 to Pulp 3 migration statistics:
============Migration Summary================
Migrated/Total RPMs: 132353/132353
Migrated/Total errata: 194411/194944
Migrated/Total repositories: 288/288
Estimated migration time based on yum content: 5 hours, 15 minutes
Note: ensure there is sufficient storage space for /var/lib/pulp/published to double in size before starting the migration process.
Check the size of /var/lib/pulp/published with 'du -sh /var/lib/pulp/published/'
Note: ensure there is sufficient storage space for postgresql.
You will need additional space for your postgresql database. The partition holding '/var/opt/rh/rh-postgresql12/lib/pgsql/data/'
will need additional free space equivalent to the size of your Mongo db database (/var/lib/mongodb/).
[OK]
--------------------------------------------------------------------------------
--> 533 ERRATA not migrated but still, the command does not complain about it.
Failure at Step 3:
Switching specified content over to pulp 3 [FAIL]
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
ERROR: at least one Erratum record has migrated_pulp3_href NULL value
Expected results:
The "foreman-maintain content prepare" or the underlying rake i.e. "foreman-rake katello:pulp3_migration" should fail if not all the ERRATA contents are migrated and should not proceed further with content-switchover phase.
The way this migration process reports about MISSING\CORRUPTED content, The rake\command should also report for UNMIGRATED ERRATA as well.
Additional info:
Even better if we get one of these outputs grabbed somewhere.
- echo "select katello_repositories.id, katello_repositories.relative_path,count(*) from katello_repository_errata \
id | relative_path | countleft join katello_repositories on katello_repositories.id = katello_repository_errata.repository_id \
where erratum_pulp3_href is null group by katello_repositories.id;" | su - postgres -c "psql foreman"
----+-------------------------------------------------------------------------------------------------+-------
40 | PFG_Pilot/Pilot_Wave/Midrange_RHEL_7_x86_64/content/dist/rhel/server/7/7Server/x86_64/extras/os | 533
(1 row)
- echo "Katello::RepositoryErratum.where(erratum_pulp3_href: nil).pluck(:repository_id).uniq" | foreman-rake console
[40]