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: CLOSED ERRATA QA Contact: Eran Kuris <ekuris>
Severity: low Docs Contact:
Priority: high    
Version: 16.2 (Train)CC: chrisw, froyo, jlibosva, mariel, scohen
Target Milestone: z6Keywords: Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-neutron-15.3.5-2.20230831144916.63bac0f.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2193412 (view as bug list) Environment:
Last Closed: 2023-11-08 19:18:34 UTC 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

Comment 10 Vadim Khitrin 2023-10-02 12:05:23 UTC
Confirmed on `RHOS-16.2-RHEL-8-20230926.n.1` compose.

Previously created `demo` project and `user`, created a dummy `TEST` role, assigned `TEST` role to user `demo` in project `demo`.

Created (or shared) a network in the `demo` project, and created a port:
```
 openstack --os-cloud demo port create --network management_net_management weak_port
```

Assigned Floating IP as admin user to port created in `demo` project:
```
openstack --os-cloud overcloud floating ip set 10.46.185.59 --port 3f50c8e6-3514-422f-87d2-8398c00eaa15
```

Attempting to delete the port as a `demo` user returns 409:
```
openstack --os-cloud demo port delete 3f50c8e6-3514-422f-87d2-8398c00eaa15
Failed to delete port with name or ID '3f50c8e6-3514-422f-87d2-8398c00eaa15': ConflictException: 409: Client Error for url: http://10.46.185.41:9696/v2.0/ports/3f50c8e6-3514-422f-87d2-8398c00eaa15, Unable to complete the operation on port "3f50c8e6-3514-422f-87d2-8398c00eaa15" because the port still has an associated floating IP.
1 of 1 ports failed to delete.
```

Comment 18 errata-xmlrpc 2023-11-08 19:18:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform 16.2.6 (Train) bug fix and enhancement advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6307