Merge "Pass existing DB obj to save DB requests" into stable/victoria
This commit is contained in:
commit
1d5ced1b39
|
@ -418,10 +418,12 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||||
return network
|
return network
|
||||||
|
|
||||||
@db_api.retry_if_session_inactive()
|
@db_api.retry_if_session_inactive()
|
||||||
def update_network(self, context, id, network):
|
def update_network(self, context, id, network, db_network=None):
|
||||||
n = network['network']
|
n = network['network']
|
||||||
|
# we dont't use DB objects not belonging to the current active session
|
||||||
|
db_network = db_network if context.session.is_active else None
|
||||||
with db_api.CONTEXT_WRITER.using(context):
|
with db_api.CONTEXT_WRITER.using(context):
|
||||||
network = self._get_network(context, id)
|
network = db_network or self._get_network(context, id)
|
||||||
# validate 'shared' parameter
|
# validate 'shared' parameter
|
||||||
if 'shared' in n:
|
if 'shared' in n:
|
||||||
entry = None
|
entry = None
|
||||||
|
@ -1459,11 +1461,13 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||||
new_mac, current_owner)
|
new_mac, current_owner)
|
||||||
|
|
||||||
@db_api.retry_if_session_inactive()
|
@db_api.retry_if_session_inactive()
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port, db_port=None):
|
||||||
|
# we dont't use DB objects not belonging to the current active session
|
||||||
|
db_port = db_port if context.session.is_active else None
|
||||||
new_port = port['port']
|
new_port = port['port']
|
||||||
|
|
||||||
with db_api.CONTEXT_WRITER.using(context):
|
with db_api.CONTEXT_WRITER.using(context):
|
||||||
db_port = self._get_port(context, id)
|
db_port = db_port or self._get_port(context, id)
|
||||||
new_mac = new_port.get('mac_address')
|
new_mac = new_port.get('mac_address')
|
||||||
self._validate_port_for_update(context, db_port, new_port, new_mac)
|
self._validate_port_for_update(context, db_port, new_port, new_mac)
|
||||||
# Note: _make_port_dict is called here to load extension data
|
# Note: _make_port_dict is called here to load extension data
|
||||||
|
|
|
@ -1089,9 +1089,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
self._update_provider_network_attributes(
|
self._update_provider_network_attributes(
|
||||||
context, original_network, net_data)
|
context, original_network, net_data)
|
||||||
|
|
||||||
updated_network = super(Ml2Plugin, self).update_network(context,
|
updated_network = super(Ml2Plugin, self).update_network(
|
||||||
id,
|
context, id, network, db_network=db_network)
|
||||||
network)
|
|
||||||
self.extension_manager.process_update_network(context, net_data,
|
self.extension_manager.process_update_network(context, net_data,
|
||||||
updated_network)
|
updated_network)
|
||||||
self._process_l3_update(context, updated_network, net_data)
|
self._process_l3_update(context, updated_network, net_data)
|
||||||
|
@ -1651,7 +1650,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
need_port_update_notify |= mac_address_updated
|
need_port_update_notify |= mac_address_updated
|
||||||
original_port = self._make_port_dict(port_db)
|
original_port = self._make_port_dict(port_db)
|
||||||
updated_port = super(Ml2Plugin, self).update_port(context, id,
|
updated_port = super(Ml2Plugin, self).update_port(context, id,
|
||||||
port)
|
port,
|
||||||
|
db_port=port_db)
|
||||||
self.extension_manager.process_update_port(context, attrs,
|
self.extension_manager.process_update_port(context, attrs,
|
||||||
updated_port)
|
updated_port)
|
||||||
self._portsec_ext_port_update_processing(updated_port, context,
|
self._portsec_ext_port_update_processing(updated_port, context,
|
||||||
|
|
Loading…
Reference in New Issue