From 232d1d26ea096c1e3b5f92b46029e67689185ae1 Mon Sep 17 00:00:00 2001
From: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Date: Fri, 11 Oct 2024 06:09:33 +0000
Subject: [PATCH] "security_group_rules" is not a SG selectable field

When building the security group dictionary, it is not needed to
build the security group rules objects individually. These objects
(OVO) are built along with the security group OVO and added in
the result dictionary in ``_make_security_group_dict``.

Related-Bug: #2083682

Change-Id: I66fbf8487b390f7685ef0a4e44c3f58b79cab05f
---
 neutron/db/securitygroups_db.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/neutron/db/securitygroups_db.py b/neutron/db/securitygroups_db.py
index 2da7b75c2b8..bc601b6e430 100644
--- a/neutron/db/securitygroups_db.py
+++ b/neutron/db/securitygroups_db.py
@@ -199,12 +199,6 @@ class SecurityGroupDbMixin(
             with db_api.CONTEXT_READER.using(context):
                 sg = self._get_security_group(context, id, fields=fields)
                 ret = self._make_security_group_dict(context, sg, fields)
-                if (fields is None or len(fields) == 0 or
-                        'security_group_rules' in fields):
-                    rules = self.get_security_group_rules(
-                        context_lib.get_admin_context(),
-                        {'security_group_id': [id]})
-                    ret['security_group_rules'] = rules
 
         finally:
             if tenant_id: