commit 00f1d325bd30dd6bfd9e1dde94c5df6acda51549 Author: Rodolfo Alonso Hernandez Date: Fri Oct 2 16:29:25 2020 +0000 Do not retrieve again the Floating IP object during creation Floating IP OVO instance contains a reference to the DB object. During a DB transaction (inside a session context), this reference is always updated. There is no need to retrieve again the OVO to read the updated version of the DB object. For example, if a QoS policy is assigned to this Floating IP, the DB object will update the "qos_policy_binding" reference. Change-Id: Iec2552362f6c52842f12e20798324d4180d993e5 Related-Bug: #1880969 diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index 2b74fe7..378c70c 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -1347,14 +1347,11 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase, context, floatingip_dict, fip) if self._is_fip_qos_supported: self._process_extra_fip_qos_create(context, fip_id, fip) - floatingip_obj = l3_obj.FloatingIP.get_object( - context, id=floatingip_obj.id) - floatingip_db = floatingip_obj.db_obj registry.notify(resources.FLOATING_IP, events.PRECOMMIT_CREATE, self, context=context, floatingip=fip, floatingip_id=fip_id, - floatingip_db=floatingip_db) + floatingip_db=floatingip_obj.db_obj) self._core_plugin.update_port( context.elevated(), external_port['id'], @@ -1378,7 +1375,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase, # TODO(lujinluo): Change floatingip_db to floatingip_obj once all # codes are migrated to use Floating IP OVO object. resource_extend.apply_funcs(l3_apidef.FLOATINGIPS, floatingip_dict, - floatingip_db) + floatingip_obj.db_obj) return floatingip_dict @db_api.retry_if_session_inactive()