make default transport type configurable nvp

Fixes bug 1179759

Change-Id: I8f644f2bc0d5d144f52e5ed0bd2e991503581ad2
This commit is contained in:
Aaron Rosen 2013-05-13 19:48:27 -07:00
parent 2a0e7f2fa7
commit 531f8d880d
4 changed files with 14 additions and 6 deletions

View File

@ -113,3 +113,6 @@ sql_connection = sqlite://
# This option is only useful if running on a host that does not support
# namespaces otherwise access_network should be used.
# metadata_mode = access_network
# The default network transport type to use (stt, gre, bridge, ipsec_gre, or ipsec_stt)
# default_transport_type = stt

View File

@ -41,6 +41,9 @@ nvp_opts = [
cfg.BoolOpt('enable_metadata_access_network', default=True,
help=_("Enables dedicated connection to the metadata proxy "
"for metadata server access via Quantum router")),
cfg.StrOpt('default_transport_type', default='stt',
help=_("The default network tranport type to use (stt, gre, "
"bridge, ipsec_gre, or ipsec_stt)")),
]
connection_opts = [

View File

@ -26,6 +26,8 @@ import inspect
import json
import logging
from oslo.config import cfg
#FIXME(danwent): I'd like this file to get to the point where it has
# no quantum-specific logic in it
from quantum.common import constants
@ -40,8 +42,6 @@ HTTP_GET = "GET"
HTTP_POST = "POST"
HTTP_DELETE = "DELETE"
HTTP_PUT = "PUT"
# Default transport type for logical switches
DEF_TRANSPORT_TYPE = "stt"
# Prefix to be used for all NVP API calls
URI_PREFIX = "/ws.v1"
# Resources exposed by NVP API
@ -296,10 +296,11 @@ def create_lswitch(cluster, tenant_id, display_name,
nvp_binding_type = transport_type
if transport_type in ('flat', 'vlan'):
nvp_binding_type = 'bridge'
transport_zone_config = {"zone_uuid": (transport_zone_uuid or
cluster.default_tz_uuid),
"transport_type": (nvp_binding_type or
DEF_TRANSPORT_TYPE)}
transport_zone_config = (
{"zone_uuid": (transport_zone_uuid or
cluster.default_tz_uuid),
"transport_type": (nvp_binding_type or
cfg.CONF.NVP.default_transport_type)})
lswitch_obj = {"display_name": _check_and_truncate_name(display_name),
"transport_zones": [transport_zone_config],
"tags": [{"tag": tenant_id, "scope": "os_tid"},

View File

@ -120,6 +120,7 @@ class ConfigurationTest(testtools.TestCase):
self.assertEqual(64, cfg.CONF.NVP.max_lp_per_bridged_ls)
self.assertEqual(256, cfg.CONF.NVP.max_lp_per_overlay_ls)
self.assertEqual(5, cfg.CONF.NVP.concurrent_connections)
self.assertEqual('stt', cfg.CONF.NVP.default_transport_type)
self.assertIsNone(cfg.CONF.default_tz_uuid)
self.assertIsNone(cfg.CONF.nvp_cluster_uuid)