I think we might want to put more than just the repo_group_id as the resource that is being reserved. I believe we had discussed making a utility function to generate resource_ids based on the type and its id, as opposed to just using the id. That way, two disparate types that happen to share the same ID won't block each other.

I suggest that you create a pulp.server.async.tasks.generate_resource_id(type, object_id) function, and use that to generate the resource_id that is being reserved here. Then you can pass "RepoGroup" and repo_group_id to it to generate the resource_id to reserve.

I think we will need this everywhere in this pull request.