Log dissasociation event when a FIP is deleted
If a floating IP has an associated port, when the floating IP is deleted, a disassociation message is logged. This is related to LP#1842327. Neutron does not consider the floating IP deletion as a disassociation event thus is not logged. This patch completes the original implementation [1]. [1]https://review.opendev.org/#/c/679667/ Change-Id: I3a01d967be09cca4db060057948d087d17e0791b Related-Bug: #1842327
This commit is contained in:
parent
164f12349f
commit
b207f05ba7
|
@ -1483,6 +1483,12 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||
l3_port_check=False)
|
||||
registry.notify(resources.FLOATING_IP, events.AFTER_DELETE,
|
||||
self, context=context, **floatingip_dict)
|
||||
if floatingip.fixed_port_id:
|
||||
LOG.info(FIP_ASSOC_MSG,
|
||||
{'fip_id': floatingip.id,
|
||||
'ext_ip': str(floatingip.floating_ip_address),
|
||||
'port_id': floatingip.fixed_port_id,
|
||||
'assoc': 'disassociated (deleted)'})
|
||||
return floatingip_dict
|
||||
|
||||
@db_api.retry_if_session_inactive()
|
||||
|
|
|
@ -4606,6 +4606,11 @@ class L3DBFloatingIpTestCaseLogging(L3BaseForSepTests, L3NatTestCaseMixin):
|
|||
'assoc': 'associated'}
|
||||
self.mock_log.info.assert_called_once_with(l3_db.FIP_ASSOC_MSG,
|
||||
msg_vars)
|
||||
self.mock_log.reset_mock()
|
||||
|
||||
msg_vars['assoc'] = 'disassociated (deleted)'
|
||||
self.mock_log.info.assert_called_once_with(l3_db.FIP_ASSOC_MSG,
|
||||
msg_vars)
|
||||
|
||||
def test_update_floatingip_event_logging(self):
|
||||
with self.port() as port:
|
||||
|
@ -4624,6 +4629,11 @@ class L3DBFloatingIpTestCaseLogging(L3BaseForSepTests, L3NatTestCaseMixin):
|
|||
'assoc': 'associated'}
|
||||
self.mock_log.info.assert_called_once_with(l3_db.FIP_ASSOC_MSG,
|
||||
msg_vars)
|
||||
self.mock_log.reset_mock()
|
||||
|
||||
msg_vars['assoc'] = 'disassociated (deleted)'
|
||||
self.mock_log.info.assert_called_once_with(l3_db.FIP_ASSOC_MSG,
|
||||
msg_vars)
|
||||
|
||||
def test_update_floatingip_event_logging_disassociate(self):
|
||||
with self.floatingip_with_assoc() as fip:
|
||||
|
@ -4639,3 +4649,6 @@ class L3DBFloatingIpTestCaseLogging(L3BaseForSepTests, L3NatTestCaseMixin):
|
|||
'assoc': 'disassociated'}
|
||||
self.mock_log.info.assert_called_once_with(l3_db.FIP_ASSOC_MSG,
|
||||
msg_vars)
|
||||
self.mock_log.reset_mock()
|
||||
|
||||
self.mock_log.assert_not_called()
|
||||
|
|
Loading…
Reference in New Issue