Merge "[OVN][QoS] Remove OVN QoS rule when FIP is dissasociated"

This commit is contained in:
Zuul
2021-02-25 11:25:28 +00:00
committed by Gerrit Code Review
3 changed files with 12 additions and 5 deletions

View File

@@ -948,7 +948,9 @@ class OVNClient(object):
def disassociate_floatingip(self, floatingip, router_id):
lrouter = utils.ovn_name(router_id)
try:
self._delete_floatingip(floatingip, lrouter)
with self._nb_idl.transaction(check_error=True) as txn:
self._delete_floatingip(floatingip, lrouter, txn=txn)
self._qos_driver.delete_floatingip(txn, floatingip)
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.error('Unable to disassociate floating ip in gateway '

View File

@@ -294,8 +294,11 @@ class OVNL3RouterPlugin(service_base.ServicePluginBase,
router_id = fip.get('router_id')
fixed_ip_address = fip.get('fixed_ip_address')
if router_id and fixed_ip_address:
update_fip = {'logical_ip': fixed_ip_address,
'external_ip': fip['floating_ip_address']}
update_fip = {
'id': fip['id'],
'logical_ip': fixed_ip_address,
'external_ip': fip['floating_ip_address'],
'floating_network_id': fip['floating_network_id']}
try:
self._ovn_client.disassociate_floatingip(update_fip,
router_id)

View File

@@ -1335,13 +1335,15 @@ class TestOVNL3RouterPlugin(test_mech_driver.Ml2PluginV2TestCase):
'router_id': 'router-id',
'port_id': 'port_id',
'floating_port_id': 'fip-port-id1',
'fixed_ip_address': '10.0.0.10'},
'fixed_ip_address': '10.0.0.10',
'floating_network_id': 'net1'},
{'id': 'fip-id2',
'floating_ip_address': '192.167.0.10',
'router_id': 'router-id',
'port_id': 'port_id',
'floating_port_id': 'fip-port-id2',
'fixed_ip_address': '10.0.0.11'}]
'fixed_ip_address': '10.0.0.11',
'floating_network_id': 'net2'}]
self.l3_inst.disassociate_floatingips(self.context, 'port_id',
do_notify=False)