Merge "Remove unneeded DB register retrieval and refresh in network update" into stable/ussuri

This commit is contained in:
Zuul 2021-05-06 04:59:52 +00:00 committed by Gerrit Code Review
commit 7df0417208
1 changed files with 4 additions and 10 deletions

View File

@ -1080,7 +1080,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
need_network_update_notify = False need_network_update_notify = False
with db_api.CONTEXT_WRITER.using(context): with db_api.CONTEXT_WRITER.using(context):
original_network = self.get_network(context, id) db_network = self._get_network(context, id)
original_network = self.get_network(context, id, net_db=db_network)
self._update_provider_network_attributes( self._update_provider_network_attributes(
context, original_network, net_data) context, original_network, net_data)
@ -1091,12 +1092,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
updated_network) updated_network)
self._process_l3_update(context, updated_network, net_data) self._process_l3_update(context, updated_network, net_data)
# ToDO(QoS): This would change once EngineFacade moves out
db_network = self._get_network(context, id)
# Expire the db_network in current transaction, so that the join
# relationship can be updated.
context.session.expire(db_network)
if mtuw_apidef.MTU in net_data: if mtuw_apidef.MTU in net_data:
db_network.mtu = self._get_network_mtu(db_network) db_network.mtu = self._get_network_mtu(db_network)
# agents should now update all ports to reflect new MTU # agents should now update all ports to reflect new MTU
@ -1138,10 +1133,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
return updated_network return updated_network
@db_api.retry_if_session_inactive() @db_api.retry_if_session_inactive()
def get_network(self, context, id, fields=None): def get_network(self, context, id, fields=None, net_db=None):
with db_api.CONTEXT_READER.using(context): with db_api.CONTEXT_READER.using(context):
net_db = self._get_network(context, id) net_db = net_db or self._get_network(context, id)
net_data = self._make_network_dict(net_db, context=context) net_data = self._make_network_dict(net_db, context=context)
self.type_manager.extend_network_dict_provider(context, net_data) self.type_manager.extend_network_dict_provider(context, net_data)