Merge "NSX: Make replication mode configurable"

This commit is contained in:
Jenkins 2014-03-21 18:52:20 +00:00 committed by Gerrit Code Review
commit e8742cfd33
8 changed files with 48 additions and 4 deletions

View File

@ -133,6 +133,12 @@
# ignored, as new networks will no longer be scheduled to existing dhcp agents. # ignored, as new networks will no longer be scheduled to existing dhcp agents.
# agent_mode = agent # agent_mode = agent
# Specifies which mode packet replication should be done in. If set to service
# a service node is required in order to perform packet replication. This can
# also be set to source if one wants replication to be performed locally (NOTE:
# usually only useful for testing if one does not want to deploy a service node).
# replication_mode = service
[nsx_sync] [nsx_sync]
# Interval in seconds between runs of the status synchronization task. # Interval in seconds between runs of the status synchronization task.
# The plugin will aim at resynchronizing operational status for all # The plugin will aim at resynchronizing operational status for all

View File

@ -128,6 +128,12 @@
# ignored, as new networks will no longer be scheduled to existing dhcp agents. # ignored, as new networks will no longer be scheduled to existing dhcp agents.
# agent_mode = agent # agent_mode = agent
# Specifies which mode packet replication should be done in. If set to service
# a service node is required in order to perform packet replication. This can
# also be set to source if one wants replication to be performed locally (NOTE:
# usually only useful for testing if one does not want to deploy a service node).
# replication_mode = service
[nsx_sync] [nsx_sync]
# Interval in seconds between runs of the status synchronization task. # Interval in seconds between runs of the status synchronization task.
# The plugin will aim at resynchronizing operational status for all # The plugin will aim at resynchronizing operational status for all

View File

@ -16,6 +16,8 @@
from oslo.config import cfg from oslo.config import cfg
from neutron.plugins.vmware.common import exceptions as nsx_exc
class AgentModes: class AgentModes:
AGENT = 'agent' AGENT = 'agent'
@ -28,6 +30,11 @@ class MetadataModes:
INDIRECT = 'dhcp_host_route' INDIRECT = 'dhcp_host_route'
class ReplicationModes:
SERVICE = 'service'
SOURCE = 'source'
base_opts = [ base_opts = [
cfg.IntOpt('max_lp_per_bridged_ls', default=5000, cfg.IntOpt('max_lp_per_bridged_ls', default=5000,
deprecated_group='NVP', deprecated_group='NVP',
@ -61,7 +68,12 @@ base_opts = [
"bridge, ipsec_gre, or ipsec_stt)")), "bridge, ipsec_gre, or ipsec_stt)")),
cfg.StrOpt('agent_mode', default=AgentModes.AGENT, cfg.StrOpt('agent_mode', default=AgentModes.AGENT,
deprecated_group='NVP', deprecated_group='NVP',
help=_("The mode used to implement DHCP/metadata services.")) help=_("The mode used to implement DHCP/metadata services.")),
cfg.StrOpt('replication_mode', default=ReplicationModes.SERVICE,
help=_("The default option leverages service nodes to perform"
" packet replication though one could set to this to "
"'source' to perform replication locally. This is useful"
" if one does not want to deploy a service node(s)."))
] ]
sync_opts = [ sync_opts = [
@ -176,3 +188,11 @@ cfg.CONF.register_opts(cluster_opts)
cfg.CONF.register_opts(vcns_opts, group="vcns") cfg.CONF.register_opts(vcns_opts, group="vcns")
cfg.CONF.register_opts(base_opts, group="NSX") cfg.CONF.register_opts(base_opts, group="NSX")
cfg.CONF.register_opts(sync_opts, group="NSX_SYNC") cfg.CONF.register_opts(sync_opts, group="NSX_SYNC")
def validate_config_options():
if cfg.CONF.NSX.replication_mode not in (ReplicationModes.SERVICE,
ReplicationModes.SOURCE):
error = (_("Invalid replication_mode: %s") %
cfg.CONF.NSX.replication_mode)
raise nsx_exc.NsxPluginException(err_msg=error)

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.config import cfg
from neutron.common import exceptions as exception from neutron.common import exceptions as exception
from neutron.openstack.common import excutils from neutron.openstack.common import excutils
from neutron.openstack.common import jsonutils from neutron.openstack.common import jsonutils
@ -54,7 +56,8 @@ def _prepare_lrouter_body(name, neutron_router_id, tenant_id,
"routing_config": { "routing_config": {
"type": router_type "type": router_type
}, },
"type": "LogicalRouterConfig" "type": "LogicalRouterConfig",
"replication_mode": cfg.CONF.NSX.replication_mode,
} }
# add the distributed key only if not None (ie: True or False) # add the distributed key only if not None (ie: True or False)
if distributed is not None: if distributed is not None:

View File

@ -16,6 +16,8 @@
import json import json
from oslo.config import cfg
from neutron.common import constants from neutron.common import constants
from neutron.common import exceptions as exception from neutron.common import exceptions as exception
from neutron.openstack.common import log from neutron.openstack.common import log
@ -115,6 +117,7 @@ def create_lswitch(cluster, neutron_net_id, tenant_id, display_name,
# historical reasons # historical reasons
lswitch_obj = {"display_name": utils.check_and_truncate(display_name), lswitch_obj = {"display_name": utils.check_and_truncate(display_name),
"transport_zones": transport_zones_config, "transport_zones": transport_zones_config,
"replication_mode": cfg.CONF.NSX.replication_mode,
"tags": utils.get_tags(os_tid=tenant_id, "tags": utils.get_tags(os_tid=tenant_id,
quantum_net_id=neutron_net_id)} quantum_net_id=neutron_net_id)}
# TODO(salv-orlando): Now that we have async status synchronization # TODO(salv-orlando): Now that we have async status synchronization

View File

@ -123,6 +123,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
def __init__(self): def __init__(self):
super(NsxPluginV2, self).__init__() super(NsxPluginV2, self).__init__()
config.validate_config_options()
# TODO(salv-orlando): Replace These dicts with # TODO(salv-orlando): Replace These dicts with
# collections.defaultdict for better handling of default values # collections.defaultdict for better handling of default values
# Routines for managing logical ports in NSX # Routines for managing logical ports in NSX

View File

@ -16,6 +16,8 @@
import mock import mock
from oslo.config import cfg
from neutron.common import exceptions from neutron.common import exceptions
from neutron.openstack.common import uuidutils from neutron.openstack.common import uuidutils
from neutron.plugins.vmware.api_client import exception as api_exc from neutron.plugins.vmware.api_client import exception as api_exc
@ -115,7 +117,8 @@ class TestExplicitLRouters(base.NsxlibTestCase):
'type': 'SingleDefaultRouteImplicitRoutingConfig'}, 'type': 'SingleDefaultRouteImplicitRoutingConfig'},
'tags': utils.get_tags(os_tid='fake_tenant_id', 'tags': utils.get_tags(os_tid='fake_tenant_id',
q_router_id='pipita_higuain'), q_router_id='pipita_higuain'),
'type': 'LogicalRouterConfig'} 'type': 'LogicalRouterConfig',
'replication_mode': cfg.CONF.NSX.replication_mode}
self.assertEqual(expected, body) self.assertEqual(expected, body)
def test_prepare_body_without_routing_config(self): def test_prepare_body_without_routing_config(self):
@ -129,7 +132,8 @@ class TestExplicitLRouters(base.NsxlibTestCase):
'routing_config': {'type': 'RoutingTableRoutingConfig'}, 'routing_config': {'type': 'RoutingTableRoutingConfig'},
'tags': utils.get_tags(os_tid='fake_tenant_id', 'tags': utils.get_tags(os_tid='fake_tenant_id',
q_router_id='marekiaro_hamsik'), q_router_id='marekiaro_hamsik'),
'type': 'LogicalRouterConfig'} 'type': 'LogicalRouterConfig',
'replication_mode': cfg.CONF.NSX.replication_mode}
self.assertEqual(expected, body) self.assertEqual(expected, body)
def test_get_lrouter(self): def test_get_lrouter(self):

View File

@ -121,6 +121,7 @@ class ConfigurationTest(base.BaseTestCase):
self.assertEqual(10, cfg.CONF.NSX.concurrent_connections) self.assertEqual(10, cfg.CONF.NSX.concurrent_connections)
self.assertEqual('access_network', cfg.CONF.NSX.metadata_mode) self.assertEqual('access_network', cfg.CONF.NSX.metadata_mode)
self.assertEqual('stt', cfg.CONF.NSX.default_transport_type) self.assertEqual('stt', cfg.CONF.NSX.default_transport_type)
self.assertEqual('service', cfg.CONF.NSX.replication_mode)
self.assertIsNone(cfg.CONF.default_tz_uuid) self.assertIsNone(cfg.CONF.default_tz_uuid)
self.assertEqual('admin', cfg.CONF.nsx_user) self.assertEqual('admin', cfg.CONF.nsx_user)