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

When an floating IP is dissasociated from an internal port, the QoS
rule in the OVN database should be removed too. This patch adds a
QoS extension call to delete the QoS rules in OVN in this case.

Change-Id: I00794e9c6403bbe528ea398b981e54d41d53b5a5
Closes-Bug: #1916470
This commit is contained in:
Rodolfo Alonso Hernandez 2021-02-22 10:30:13 +00:00
parent 47eecd9b67
commit 3398e6abc0
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)