It's because the context doesn't have a project_id so the first pass creates a record with project_id=None:
https://github.com/openstack/nova/blob/03322bb517925a9f5a04ebdb41c3fd31e7962440/nova/db/sqlalchemy/api.py#L4037
There is also a unique constraint on project_id/name/deleted:
https://github.com/openstack/nova/blob/01c33c584f7209ae02bc537adea85502d52f1c22/nova/db/sqlalchemy/models.py#L660
The migration is just using an admin context which doesn't have a project_id:
https://github.com/openstack/nova/blob/f853e04cd22acc36c906ffb29084160fa05d1ebd/nova/cmd/manage.py#L715
https://github.com/openstack/nova/blob/f853e04cd22acc36c906ffb29084160fa05d1ebd/nova/context.py#L292
It's because the context doesn't have a project_id so the first pass creates a record with project_id=None:
https:/ /github. com/openstack/ nova/blob/ 03322bb517925a9 f5a04ebdb41c3fd 31e7962440/ nova/db/ sqlalchemy/ api.py# L4037
There is also a unique constraint on project_ id/name/ deleted:
https:/ /github. com/openstack/ nova/blob/ 01c33c584f7209a e02bc537adea855 02d52f1c22/ nova/db/ sqlalchemy/ models. py#L660
The migration is just using an admin context which doesn't have a project_id:
https:/ /github. com/openstack/ nova/blob/ f853e04cd22acc3 6c906ffb2908416 0fa05d1ebd/ nova/cmd/ manage. py#L715
https:/ /github. com/openstack/ nova/blob/ f853e04cd22acc3 6c906ffb2908416 0fa05d1ebd/ nova/context. py#L292