Bug 2186758

Summary: trying to remove a tenant port associated to a FIP by admin fails with resultCode: 500
Product: Red Hat OpenStack Reporter: rlobillo
Component: openstack-neutronAssignee: Fernando Royo <froyo>
Status: POST --- QA Contact: Eran Kuris <ekuris>
Severity: low Docs Contact:
Priority: high    
Version: 16.2 (Train)CC: chrisw, froyo, jlibosva, scohen
Target Milestone: z6Keywords: Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2193412 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2193412    
Attachments:
Description Flags
egressip_test.yaml none

Description rlobillo 2023-04-14 10:53:09 UTC
Created attachment 1957464 [details]
egressip_test.yaml

Created attachment 1957464 [details]
egressip_test.yaml

Description of problem:
While running egressIP feature testing for OCP on OSP, below issue is observed: A port linked to a FIP by admin user cannot be deleted but neutron is answering with resultCode 500 (internal server error). A more accurante resultCode should be provided so Openshift can handle the error accordingly.

2023-04-14 10:01:49.061 277 DEBUG neutron.plugins.ml2.plugin [req-f7246ff0-bcde-4211-84d8-1a34283ca3fb 56fabeda93e4441f8dae35f7fe5996d0 01164c5f6ddb446b90a90f49bf114732 - default default] Calling delete_port for f6e7df2b-3a4f-49e5-ac0b-c07860302d08 owned by OpenShiftEgressIP delete_port /usr/lib/python3.6/site-packages/neutron/plugins/ml2/plugin.py:1997
2023-04-14 10:01:49.077 274 DEBUG neutron.wsgi [-] (274) accepted ('172.17.1.89', 39894) server /usr/lib/python3.6/site-packages/eventlet/wsgi.py:985
2023-04-14 10:01:49.082 274 INFO neutron.wsgi [-] 172.17.1.89 "OPTIONS / HTTP/1.0" status: 200  len: 249 time: 0.0035684
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation [req-f7246ff0-bcde-4211-84d8-1a34283ca3fb 56fabeda93e4441f8dae35f7fe5996d0 01164c5f6ddb446b90a90f49bf114732 - default default] DELETE failed.: oslo_db.exception.DBReferenceError: (pymysql.err.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`ovs_neutron`.`floatingips`, CONSTRAINT `floatingips_ibfk_1` FOREIGN KEY (`fixed_port_id`) REFERENCES `ports` (`id`))')
[SQL: DELETE FROM ports WHERE ports.id = %(id)s]
[parameters: {'id': 'f6e7df2b-3a4f-49e5-ac0b-c07860302d08'}]
(Background on this error at: http://sqlalche.me/e/gkpj)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     cursor, statement, parameters, context
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     cursor.execute(statement, parameters)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/cursors.py", line 163, in execute
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     result = self._query(query)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/cursors.py", line 321, in _query
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     conn.query(q)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 505, in query
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 724, in _read_query_result
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     result.read()
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 1069, in read
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     first_packet = self.connection._read_packet()
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 676, in _read_packet
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     packet.raise_for_error()
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/protocol.py", line 223, in raise_for_error
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     err.raise_mysql_exception(self._data)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python3.6/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation     raise errorclass(errno, errval)
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation pymysql.err.IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`ovs_neutron`.`floatingips`, CONSTRAINT `floatingips_ibfk_1` FOREIGN KEY (`fixed_port_id`) REFERENCES `ports` (`id`))')
2023-04-14 10:01:49.116 277 ERROR neutron.pecan_wsgi.hooks.translation



Version-Release number of selected component (if applicable):
RHOS-16.2-RHEL-8-20220804.n.1
4.13.0-0.nightly-2023-04-13-171034

How reproducible: Always

Steps to Reproduce:
1. Create an egressIP in Openshift on Openstack
2. Associate the egressIP to a FIP which admin credentials
3. Destroy the egressIP
Steps are automated on a script linked as a private command.

Actual results:
Neutron responds with resultCode 500 everytime OCP tries to remove the port.

Expected results:
more accurante result code should be provided to openshift so it can handle the error accordingly.

Additional info:
Documented on Openshift side on https://issues.redhat.com/browse/OCPBUGS-5244