Browse Source

Merge "Get only FIP ID on network delete" into stable/wallaby

changes/93/787493/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
9bd3b40afc
2 changed files with 13 additions and 5 deletions
  1. +4
    -5
      neutron/db/l3_db.py
  2. +9
    -0
      neutron/objects/router.py

+ 4
- 5
neutron/db/l3_db.py View File

@ -1550,12 +1550,11 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
@db_api.retry_if_session_inactive()
def delete_disassociated_floatingips(self, context, network_id):
fip_objs = l3_obj.FloatingIP.get_objects(
context,
floating_network_id=network_id, router_id=None, fixed_port_id=None)
fip_ids = l3_obj.FloatingIP.get_disassociated_ids_for_net(
context, network_id)
for fip in fip_objs:
self.delete_floatingip(context, fip.id)
for fip_id in fip_ids:
self.delete_floatingip(context, fip_id)
@db_api.retry_if_session_inactive()
def get_floatingips_count(self, context, filters=None):


+ 9
- 0
neutron/objects/router.py View File

@ -356,6 +356,15 @@ class FloatingIP(base.NeutronDbObject):
row = list(next(value))
yield (cls._load_object(context, row[0]), row[1])
@classmethod
def get_disassociated_ids_for_net(cls, context, network_id):
query = context.session.query(cls.db_model.id)
query = query.filter_by(
floating_network_id=network_id,
router_id=None,
fixed_port_id=None)
return [f.id for f in query]
@base.NeutronObjectRegistry.register
class DvrFipGatewayPortAgentBinding(base.NeutronDbObject):


Loading…
Cancel
Save