Task #5845
closedStory #3821: As a user, I can migrate from Pulp 2 to Pulp 3
Update get_pulp3_repository_setup so repos are grouped by plugin type
100%
Description
Motivation:¶
Repositories became typed, therefore for each incoming repo we need to identify it's type in order to migrate it
https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/migration.py#L68
for pulp2repo in pulp2repos_qs:
pulp3_repo_name = pulp2repo.pulp2_repo_id
repository_class = PLUGIN_MIGRATORS.get(pulp2repo.type).pulp3_repository
repo, created = repository_class.objects.get_or_create(
name=pulp3_repo_name,
description=pulp2repo.pulp2_description)
Identifying `repository_class` for each repo might have performance impact
In case we'd like to 'migrate' a repo to pulp3 that is not present in pulp2, or in other words - migrate pulp2 repo with new name in pulp3 we'd have troubles to find its `repository_class`
for pulp3_repo_name in repos_to_create:
try:
pulp2repo = pulp2repos_qs.get(pulp2_repo_id=pulp3_repo_name)
except Pulp2Repository.DoesNotExist:
description = pulp3_repo_name
else:
description = pulp2repo.pulp2_description
repository_class = PLUGIN_MIGRATORS.get(pulp2repo.type).pulp3_repository
repo, created = repository_class.objects.get_or_create(
name=pulp3_repo_name,
description=description)
https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/migration.py#L91
Solution¶
Having repos grouped by plugin type( iso, docker. rpm) would help to deal with above mentioned cases.
Update plan.get_pulp3_repository_setup() so it would have following structure:
{iso: {repoA : repo_data, repoB: repo_data}, docker: {repoA : repo_data, repoB: repo_data}}
Refactor migration plan parsing to keep track of plugin types
closes: #5845 https://pulp.plan.io/issues/5845 closes: #5899 https://pulp.plan.io/issues/5899