Project

Profile

Help

Task #5837

Updated by ipanova@redhat.com almost 2 years ago

h3. Motivation

Distributor can't be identified by @distributor_id@, the uniqueness constraint for pulp2 distributor is `distributor_id` + `repo_id`.
pulp-admin creates a distributor with @distributor_id=distributor_type_id@, so we can't rely on distributor_id at all. It can be the same for many repositories.

h3. Solution

Migration plan will accept pulp2_distributor_repository_ids( repo_id of the distributor associated to it). If repo has 2 distributors, we will migrate both of them.

Update Migration plan parsing: fetch distributors from the mentioned repos, filter only those distributors type that are specified in the Migrator, create a namedtuple that will contain pulp2repo _id( we want to migrate) and distributor Object ID( distributor we want to use to create Distribution)

h3. Example of a plan

<pre>

{
"plugins": [
{
"type": "iso", # it should be a pulp2 type
"repositories" : [
{
"name": "foo",
"pulp2_importer_repository_id": "my_repo_id to use to find an importer to migrate"
"repository_versions": [
{
"pulp2_repository_id": "idA",
"distributor_ids": ["pulp2_distributor_repository_id1", "pulp2_distributor_repository_id2"]

},
{
"pulp2_repository_id": "idB",
"distributor_ids": ["pulp2_distributor_repository_id3"]
},
]
}
]
},
{
"type": "docker",
}
]
}

</pre>


h3. Example of parsed plan

<pre>

repodistribution = namedtuple('repodistribution', ['repo_id', 'dist_ids'])

pulp3_repo_setup = {'foo': {'pulp2_importer_repository_id': 'my_repo_id', 'versions': [repodistribution('idA', [ObjectId("5de97a32c998ac5dffb0d6a4"), ObjectId("5de97a33c998ac5dffb0d6aa")]), repodistribution('idB', [ ObjectId("5de97a33c998ac5dffb0d6ad")])]}}
</pre>

Back