Bug 1988793

Summary: Security group log entry remains in the database after its security group is deleted
Product: Red Hat OpenStack Reporter: Alex Katz <akatz>
Component: openstack-neutronAssignee: Slawek Kaplonski <skaplons>
Status: CLOSED ERRATA QA Contact: ayenachew molla <amolla>
Severity: high Docs Contact:
Priority: high    
Version: 17.0 (Wallaby)CC: akatz, amolla, apevec, ccamposr, chrisw, jlibosva, jpichon, lhh, scohen, skaplons
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-neutron-18.1.2-0.20211115161911.01a3f8d.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2029310 (view as bug list) Environment:
Last Closed: 2022-09-21 12:16:15 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: 1619266, 2029310    

Description Alex Katz 2021-08-01 06:55:18 UTC
Description of problem:
After the security group is deleted its corresponding log entry is still presented in the database.


Version-Release number of selected component (if applicable):


How reproducible:
Reproduced in ml2/OVS and ml2/OVN setups


Steps to Reproduce:
# openstack security group create sg_1
# openstack network log create --resource-type security_group --resource sg_1 --event ALL test_log
# openstack security group delete sg_1
# openstack network log show test_log

Actual results:
there is sill entry for `test_log`

Expected results:
security group deletion should fail with the clear error message or the cascade deletion should happen


Additional info:

Comment 6 ayenachew molla 2022-05-10 07:49:03 UTC
verified version - RHOS-17.0-RHEL-9-20220414.n.1

There is an example of all the command output:

(overcloud) [stack@undercloud-0 ~]$ openstack security group create sg_1
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field           | Value                                                                                                                                                                           |
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at      | 2022-05-10T07:25:51Z                                                                                                                                                            |
| description     | sg_1                                                                                                                                                                            |
| id              | 845ad072-2752-4a9a-9819-4d6c3127d3e8                                                                                                                                            |
| name            | sg_1                                                                                                                                                                            |
| project_id      | f8a8b202c8ec47ff96cb84ad090642d2                                                                                                                                                |
| revision_number | 1                                                                                                                                                                               |
| rules           | created_at='2022-05-10T07:25:51Z', direction='egress', ethertype='IPv4', id='686e2822-5cd0-45d9-89ff-972f2cac95d1', standard_attr_id='21668', updated_at='2022-05-10T07:25:51Z' |
|                 | created_at='2022-05-10T07:25:51Z', direction='egress', ethertype='IPv6', id='b913d2c3-052e-436d-8765-8980bfc8f0c3', standard_attr_id='21671', updated_at='2022-05-10T07:25:51Z' |
| stateful        | None                                                                                                                                                                            |
| tags            | []                                                                                                                                                                              |
| updated_at      | 2022-05-10T07:25:51Z                                                                                                                                                            |
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack network log create --resource-type security_group --resource sg_1 --event ALL test_log
+-----------------+--------------------------------------+
| Field           | Value                                |
+-----------------+--------------------------------------+
| Description     |                                      |
| Enabled         | True                                 |
| Event           | ALL                                  |
| ID              | 6234ed42-9a20-4926-8e71-978282d7bebc |
| Name            | test_log                             |
| Project         | f8a8b202c8ec47ff96cb84ad090642d2     |
| Resource        | 845ad072-2752-4a9a-9819-4d6c3127d3e8 |
| Target          | None                                 |
| Type            | security_group                       |
| created_at      | 2022-05-10T07:26:08Z                 |
| revision_number | 0                                    |
| tenant_id       | f8a8b202c8ec47ff96cb84ad090642d2     |
| updated_at      | 2022-05-10T07:26:08Z                 |
+-----------------+--------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack network log list
+--------------------------------------+---------+----------+----------------+---------------------------------------------------------------+
| ID                                   | Enabled | Name     | Type           | Summary                                                       |
+--------------------------------------+---------+----------+----------------+---------------------------------------------------------------+
| 6234ed42-9a20-4926-8e71-978282d7bebc | True    | test_log | security_group | Event: ALL,                                                   |
|                                      |         |          |                | Logged: (security_group) 845ad072-2752-4a9a-9819-4d6c3127d3e8 |
+--------------------------------------+---------+----------+----------------+---------------------------------------------------------------+

(overcloud) [stack@undercloud-0 ~]$ openstack security group delete sg_1

(overcloud) [stack@undercloud-0 ~]$ openstack network log list

(overcloud) [stack@undercloud-0 ~]$ openstack network log show test_log
Unable to find log with name or id 'test_log'

Comment 10 errata-xmlrpc 2022-09-21 12:16:15 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 (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), 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/RHEA-2022:6543