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
This commit is contained in:
parent
a918fabf56
commit
00f1d325bd
@ -1347,14 +1347,11 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||||||
context, floatingip_dict, fip)
|
context, floatingip_dict, fip)
|
||||||
if self._is_fip_qos_supported:
|
if self._is_fip_qos_supported:
|
||||||
self._process_extra_fip_qos_create(context, fip_id, fip)
|
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,
|
registry.notify(resources.FLOATING_IP, events.PRECOMMIT_CREATE,
|
||||||
self, context=context, floatingip=fip,
|
self, context=context, floatingip=fip,
|
||||||
floatingip_id=fip_id,
|
floatingip_id=fip_id,
|
||||||
floatingip_db=floatingip_db)
|
floatingip_db=floatingip_obj.db_obj)
|
||||||
|
|
||||||
self._core_plugin.update_port(
|
self._core_plugin.update_port(
|
||||||
context.elevated(), external_port['id'],
|
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
|
# TODO(lujinluo): Change floatingip_db to floatingip_obj once all
|
||||||
# codes are migrated to use Floating IP OVO object.
|
# codes are migrated to use Floating IP OVO object.
|
||||||
resource_extend.apply_funcs(l3_apidef.FLOATINGIPS, floatingip_dict,
|
resource_extend.apply_funcs(l3_apidef.FLOATINGIPS, floatingip_dict,
|
||||||
floatingip_db)
|
floatingip_obj.db_obj)
|
||||||
return floatingip_dict
|
return floatingip_dict
|
||||||
|
|
||||||
@db_api.retry_if_session_inactive()
|
@db_api.retry_if_session_inactive()
|
||||||
|
Loading…
Reference in New Issue
Block a user