From 0fd168ae93176573575c61eab370e13a4cee34ce Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Fri, 28 Jan 2022 09:32:47 +0100 Subject: [PATCH] Use elevated context to update router's external gateway When new defaults and scope enforcement are used in Neutron, elevated context needs to be used to update router's external gateway when new subnet is added to the external network. Otherwise, router can belongs to the other project than external network and it will not be updated at all. Closes-Bug: #1959331 Change-Id: I888ddf66a15cd20039ff26baccd170da128e1eb7 --- neutron/db/db_base_plugin_v2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index ec85079b5a0..830e5e17201 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -748,7 +748,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, external_gateway_info['external_fixed_ips'].append( {'subnet_id': subnet['id']}) info = {'router': {'external_gateway_info': external_gateway_info}} - l3plugin.update_router(context, router_id, info) + l3plugin.update_router(ctx_admin, router_id, info) @db_api.retry_if_session_inactive() def _create_subnet_postcommit(self, context, result,