Stop using .delete() in external net handling code

This can prevent revision bumping on a network update if the
only thing that happened was the removal of the external network
model.
This also stops the use of .delete() for the external network
RBAC entries because they are tracked by the quota engine and the
quota engine is based on SQLAlchemy event handlers.

Change-Id: Iafd1a07e693d5719437c10325739693a88e2a52f
This commit is contained in:
Kevin Benton 2017-01-09 09:06:01 -08:00
parent 52184c5f61
commit 9dea90d453
1 changed files with 6 additions and 4 deletions

View File

@ -172,10 +172,12 @@ class External_net_db_mixin(object):
if port:
raise external_net.ExternalNetworkInUse(net_id=net_id)
context.session.query(ext_net_models.ExternalNetwork).filter_by(
network_id=net_id).delete()
context.session.query(rbac_db.NetworkRBAC).filter_by(
object_id=net_id, action='access_as_external').delete()
for edb in (context.session.query(ext_net_models.ExternalNetwork).
filter_by(network_id=net_id)):
context.session.delete(edb)
for rbdb in (context.session.query(rbac_db.NetworkRBAC).filter_by(
object_id=net_id, action='access_as_external')):
context.session.delete(rbdb)
net_data[external_net.EXTERNAL] = False
def _process_l3_delete(self, context, network_id):