Revert "Cache default security group IDs in memory"

This reverts commit 433deed0b7.

Reason for revert: https://bugs.launchpad.net/neutron/+bug/1923470

Change-Id: I7d6d884936916602fb21a6f268250c823d415e6b
Closes-Bug: #1923470
changes/14/785614/1
Oleg Bondarev 2 years ago
parent 433deed0b7
commit 44670f88dd

@ -59,8 +59,6 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
__native_bulk_support = True
default_sg_cache = dict()
def create_security_group_bulk(self, context, security_groups):
return self._create_bulk('security_group', context,
security_groups)
@ -277,9 +275,6 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
**kwargs)
sg.delete()
project_id = self.default_sg_cache.pop(id, None)
self.default_sg_cache.pop(project_id, None)
kwargs.pop('security_group')
kwargs['name'] = sg['name']
registry.notify(resources.SECURITY_GROUP, events.AFTER_DELETE,
@ -886,16 +881,11 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
security_groups else [])
def _get_default_sg_id(self, context, tenant_id):
if tenant_id in self.default_sg_cache:
return self.default_sg_cache[tenant_id]
default_group = sg_obj.DefaultSecurityGroup.get_object(
context,
project_id=tenant_id,
)
if default_group:
self.default_sg_cache[tenant_id] = default_group.security_group_id
self.default_sg_cache[default_group.security_group_id] = tenant_id
return default_group.security_group_id
@registry.receives(resources.PORT, [events.BEFORE_CREATE,

@ -55,7 +55,6 @@ from neutron.api.rpc.callbacks.producer import registry as rpc_producer_reg
from neutron.common import config
from neutron.conf.agent import common as agent_config
from neutron.db import agentschedulers_db
from neutron.db import securitygroups_db
from neutron import manager
from neutron import policy
from neutron.quota import resource_registry
@ -571,8 +570,6 @@ class PluginFixture(fixtures.Fixture):
# TODO(marun) Fix plugins that do not properly initialize notifiers
agentschedulers_db.AgentSchedulerDbMixin.agent_notifiers = {}
securitygroups_db.SecurityGroupDbMixin.default_sg_cache = {}
nm.clear_instance()

Loading…
Cancel
Save