Merge "Get only FIP ID on network delete" into stable/victoria
This commit is contained in:
commit
2b54c9b5ff
|
@ -1519,12 +1519,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):
|
||||
|
|
|
@ -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…
Reference in New Issue