Bug 1929374

Summary: pulp3: Ensure a migration can be interrupted within reasonable time at any stage
Product: Red Hat Satellite Reporter: Tanya Tereshchenko <ttereshc>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: bmbouter, dalley, ggainey, ipanova, pcreech, rchan, ttereshc
Target Milestone: 6.9.0Keywords: Triaged
Target Release: Unused   
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-04-21 13:10:34 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 Tanya Tereshchenko 2021-02-16 18:33:49 UTC
Description of problem:

### Motivation
Users who have pulp 2 and pulp 3 on the same machine need to have a way to control when migration is running.
The migration plugin inevitably provides certain load on the system and uses resources. 
Users might want to choose windows when they run a migration. 
E.g. Run every Saturday for 4 hours at most.

If the system is large, it can take hours to migrate it, users need a way to cancel the task and free all the related resource within a reasonable timeframe.

### Potential issues
When there is a very slow db query and the task which triggered that query is cancelled, how quickly the db query will be aborted as well?

Comment 1 pulp-infra@redhat.com 2021-02-16 19:05:00 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 2 pulp-infra@redhat.com 2021-02-16 19:05:01 UTC
The Pulp upstream bug priority is at High. Updating the external tracker on this bug.

Comment 3 pulp-infra@redhat.com 2021-03-05 22:07:25 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 4 pulp-infra@redhat.com 2021-03-07 17:24:09 UTC
The Pulp upstream bug status is at CLOSED - COMPLETE. Updating the external tracker on this bug.

Comment 5 pulp-infra@redhat.com 2021-03-07 18:07:10 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 9 Tanya Tereshchenko 2021-03-18 18:39:36 UTC
For testing, it's good to try to stop the migration when it's in the middle of:
 - premigrating.content* (parent pulp task report) or
 - migrating.*,content (parent pulp task report) or
 - repo version creation/publication.distribution (pulp task group is not finished)

And then try to re-run it.

Comment 10 Lai 2021-03-19 19:12:04 UTC
Steps to retest:

1. On a large db, run migration command
2. When premigration message appears, use abort command to abort migration
3. Restart migration
4. When migration message appears for migrating rpm, erratas, group packages, etc, abort migration
5. Restart migration
6. When post migration message appears for importing rpm, erratas, group packages, ect, abort migration
7. Restart migration until finished

Expected
For 3,5,7, migration should restart without issue and should finish successfully on step 7

Actual
3,5,7, migration started without issues and finished successfully on step 7.

Tested on a clone customer db.

Verified on 6.9.0_017

Comment 13 errata-xmlrpc 2021-04-21 13:10:34 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 (Moderate: Satellite 6.9 Release), 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/RHSA-2021:1313