Updating common/extensions.py in order not to instantiate a QuantumManager when retrieving plugin

Also renaming API router: APIRouterV01 --> APIRouterV1
This commit is contained in:
Salvatore Orlando 2011-08-26 11:20:55 +01:00
parent f1b68c5434
commit 3d0d7384c5
6 changed files with 7 additions and 9 deletions

View File

@ -29,4 +29,4 @@ paste.filter_factory = quantum.common.extensions:plugin_aware_extension_middlewa
paste.app_factory = quantum.api.versions:Versions.factory
[app:quantumapiapp]
paste.app_factory = quantum.api:APIRouterV01.factory
paste.app_factory = quantum.api:APIRouterV1.factory

View File

@ -37,7 +37,7 @@ LOG = logging.getLogger('quantum.api')
FLAGS = flags.FLAGS
class APIRouterV01(wsgi.Router):
class APIRouterV1(wsgi.Router):
"""
Routes requests on the Quantum API to the appropriate controller
"""
@ -45,7 +45,7 @@ class APIRouterV01(wsgi.Router):
def __init__(self, options=None):
mapper = routes.Mapper()
self._setup_routes(mapper, options)
super(APIRouterV01, self).__init__(mapper)
super(APIRouterV1, self).__init__(mapper)
def _setup_routes(self, mapper, options):
# Loads the quantum plugin
@ -64,9 +64,7 @@ class APIRouterV01(wsgi.Router):
parent_resource=dict(member_name='network',
collection_name=uri_prefix +\
'networks'))
attachments_ctrl = attachments.Controller(plugin)
mapper.connect("get_resource",
uri_prefix + 'networks/{network_id}/' \
'ports/{id}/attachment{.format}',

View File

@ -338,7 +338,7 @@ def plugin_aware_extension_middleware_factory(global_config, **local_config):
def _factory(app):
extensions_path = global_config.get('api_extensions_path', '')
ext_mgr = PluginAwareExtensionManager(extensions_path,
QuantumManager().get_plugin())
QuantumManager.get_plugin())
return ExtensionMiddleware(app, global_config, ext_mgr=ext_mgr)
return _factory

View File

@ -26,7 +26,7 @@ The caller should make sure that QuantumManager is a singleton.
import gettext
import logging
import os
import logging
gettext.install('quantum', unicode=1)
from common import utils

View File

@ -87,7 +87,7 @@ class PortprofileExtensionTest(unittest.TestCase):
options = {}
options['plugin_provider'] = 'quantum.plugins.cisco.l2network_plugin'\
'.L2Network'
self.api = server.APIRouterV01(options)
self.api = server.APIRouterV1(options)
self._l2network_plugin = l2network_plugin.L2Network()
def test_list_portprofile(self):

View File

@ -763,7 +763,7 @@ class APITest(unittest.TestCase):
def setUp(self):
options = {}
options['plugin_provider'] = test_config['plugin_name']
self.api = server.APIRouterV01(options)
self.api = server.APIRouterV1(options)
self.tenant_id = "test_tenant"
self.network_name = "test_network"
self._net_serializer = \