From 363c690529fe1958d3d7710a165a7ae1a5c81ca0 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 10 May 2023 10:49:37 +0200 Subject: [PATCH] Replace "tenant_id" with "project_id" in address scope This is part of the remaining technical debt of the specs https://specs.openstack.org/openstack/neutron-specs/specs/newton/moving-to-keystone-v3.html Blueprint: https://blueprints.launchpad.net/neutron/+spec/keystone-v3 Change-Id: I5a581f7ace6c25ea40a19c23868e591ae97fce1a --- neutron/db/address_scope_db.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neutron/db/address_scope_db.py b/neutron/db/address_scope_db.py index e1c1108039a..676b444c01c 100644 --- a/neutron/db/address_scope_db.py +++ b/neutron/db/address_scope_db.py @@ -58,7 +58,7 @@ class AddressScopeDbMixin(ext_address_scope.AddressScopePluginBase): """ address_scope = self._get_address_scope(context, id) return context.is_admin or ( - address_scope.tenant_id == context.tenant_id) + address_scope.project_id == context.project_id) def get_ip_version_for_address_scope(self, context, id): address_scope = self._get_address_scope(context, id) @@ -68,7 +68,10 @@ class AddressScopeDbMixin(ext_address_scope.AddressScopePluginBase): """Create an address scope.""" a_s = address_scope['address_scope'] address_scope_id = a_s.get('id') or uuidutils.generate_uuid() - pool_args = {'project_id': a_s['tenant_id'], + # TODO(ralonsoh): remove tenant_id reference once bp/keystone-v3 + # migration finishes. + project_id = a_s.get('project_id') or a_s['tenant_id'] + pool_args = {'project_id': project_id, 'id': address_scope_id, 'name': a_s['name'], 'shared': a_s['shared'],