Browse Source

Ensure that default SG exists during list of SG rules API call

During processing of security group rule list API call Neutron will
now ensure that default security group for project given in the filters
or in the context exists.
It is similar to what is done for list of security groups or creation of
new network/port in the project.

Change-Id: Id6fee5a752968b356b884d939b708a420016c9bc
Closes-Bug: #1864171
changes/70/709070/2
Slawek Kaplonski 2 years ago
parent
commit
4739a4febb
  1. 8
      neutron/db/securitygroups_db.py

8
neutron/db/securitygroups_db.py

@ -719,6 +719,14 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
pager = base_obj.Pager(
sorts=sorts, marker=marker, limit=limit, page_reverse=page_reverse)
project_id = filters.get('project_id') or filters.get('tenant_id')
if project_id:
project_id = project_id[0]
else:
project_id = context.project_id
if project_id:
self._ensure_default_security_group(context, project_id)
if not filters and context.project_id and not context.is_admin:
rule_ids = sg_obj.SecurityGroupRule.get_security_group_rule_ids(
context.project_id)

Loading…
Cancel
Save