Merge "Ensure API extensions for NVP are loaded by default"

This commit is contained in:
Jenkins 2013-05-27 00:12:26 +00:00 committed by Gerrit Code Review
commit ff36751e1e
3 changed files with 46 additions and 0 deletions

View File

@ -22,6 +22,7 @@
import hashlib
import logging
import os
from oslo.config import cfg
from sqlalchemy.orm import exc as sa_exc
@ -71,6 +72,7 @@ LOG = logging.getLogger("QuantumPlugin")
NVP_NOSNAT_RULES_ORDER = 10
NVP_FLOATINGIP_NAT_RULES_ORDER = 224
NVP_EXTGW_NAT_RULES_ORDER = 255
NVP_EXT_PATH = os.path.join(os.path.dirname(__file__), 'extensions')
# Provider network extension - allowed network types for the NVP Plugin
@ -177,6 +179,9 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
'default': self._nvp_delete_port}
}
# If no api_extensions_path is provided set the following
if not cfg.CONF.api_extensions_path:
cfg.CONF.set_override('api_extensions_path', NVP_EXT_PATH)
self.nvp_opts = cfg.CONF.NVP
self.cluster = create_nvp_cluster(cfg.CONF,
self.nvp_opts.concurrent_connections,

View File

@ -0,0 +1,31 @@
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = False
# Address to bind the API server
bind_host = 0.0.0.0
# Port the bind the API server to
bind_port = 9696
# MISSING Path to the extensions
# api_extensions_path =
# Paste configuration file
api_paste_config = api-paste.ini.test
# The messaging module to use, defaults to kombu.
rpc_backend = quantum.openstack.common.rpc.impl_fake
lock_path = $state_path/lock
[DATABASE]
sql_connection = 'sqlite:///:memory:'
[default_servicetype]
description = "default service type"
service_definition=dummy:quantum.tests.unit.dummy_plugin.QuantumDummyPlugin

View File

@ -28,6 +28,8 @@ from quantum.plugins.nicira import nvp_cluster
BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
'../../etc/quantum.conf.test')
NVP_BASE_CONF_PATH = os.path.join(os.path.dirname(__file__),
'etc/quantum.conf.test')
NVP_INI_PATH = os.path.join(os.path.dirname(__file__),
'etc/nvp.ini.basic.test')
NVP_INI_FULL_PATH = os.path.join(os.path.dirname(__file__),
@ -136,6 +138,14 @@ class ConfigurationTest(testtools.TestCase):
self.assertIsNone(cfg.CONF.default_l2_gw_service_uuid)
self.assertEqual('breth0', cfg.CONF.default_interface_name)
def test_load_api_extensions(self):
q_config.parse(['--config-file', NVP_BASE_CONF_PATH,
'--config-file', NVP_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', NVP_PLUGIN_PATH)
# Load the configuration, and initialize the plugin
QuantumManager().get_plugin()
self.assertIn('extensions', cfg.CONF.api_extensions_path)
class OldConfigurationTest(testtools.TestCase):