Merge "Fix query error on dhcp release port for postgresql"
This commit is contained in:
commit
cdad785bc7
@ -1404,9 +1404,14 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
|
|
||||||
def delete_ports(self, context, filters):
|
def delete_ports(self, context, filters):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
ports = self._get_ports_query(
|
# Disable eagerloads to avoid postgresql issues with outer joins
|
||||||
context, filters=filters).with_lockmode('update')
|
# and SELECT FOR UPDATE. This means that only filters for columns
|
||||||
if ports:
|
# on the Port model will be effective, which is fine in nearly all
|
||||||
|
# the cases where filters are used
|
||||||
|
query = context.session.query(
|
||||||
|
models_v2.Port).enable_eagerloads(False)
|
||||||
|
ports = self._apply_filters_to_query(
|
||||||
|
query, models_v2.Port, filters).with_lockmode('update').all()
|
||||||
for port in ports:
|
for port in ports:
|
||||||
self.delete_port(context, port['id'])
|
self.delete_port(context, port['id'])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user