Cache SecurityGroupAPI results from neutron multiplexer

On a normal run of the multinode grenade job, the n-api service alone
creates nova.compute.api.SecurityGroupAPI object 183 times. This patch
caches the object after the first creation. Since there are two ways
one can instantiate that API, we cache each independently, dropping the
count from 183 to 2.

Change-Id: I0932c652fb455fe10239215a93e183ea947234e3
This commit is contained in:
Dan Smith 2015-12-10 11:53:30 -08:00
parent 5f343ea96c
commit f550cfb148

View File

@ -46,6 +46,7 @@ import testtools
from nova import context
from nova import db
from nova.network import manager as network_manager
from nova.network.security_group import openstack_driver
from nova.objects import base as objects_base
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import conf_fixture
@ -236,6 +237,8 @@ class TestCase(testtools.TestCase):
self.useFixture(nova_fixtures.PoisonFunctions())
openstack_driver.DRIVER_CACHE = {}
def _restore_obj_registry(self):
objects_base.NovaObjectRegistry._registry._obj_classes = \
self._base_test_obj_backup