]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use oslo_config choices support
authorEric Brown <browne@vmware.com>
Wed, 25 Feb 2015 23:32:50 +0000 (15:32 -0800)
committerEric Brown <browne@vmware.com>
Mon, 2 Mar 2015 22:48:25 +0000 (14:48 -0800)
The oslo_config library added support for a choices keyword argument in
version 1.2.0a3.  This commit leverages the use of choices for StrOpts in
Neutron's configuration.

References:
http://docs.openstack.org/developer/oslo.config/#a3
https://bugs.launchpad.net/oslo-incubator/+bug/1123043

Change-Id: I2f935731ed7e1dea6d297dd72960d01cb8859656

neutron/agent/l3/config.py
neutron/agent/l3/ha.py
neutron/plugins/mlnx/agent/config.py
neutron/plugins/vmware/common/config.py

index db734168a2140afed7d7d2c91afbd367dad12806..49e5dd51614b5858a10fede54e53e5a62673ed78 100644 (file)
 
 from oslo_config import cfg
 
+from neutron.common import constants
+
 
 OPTS = [
-    cfg.StrOpt('agent_mode', default='legacy',
+    cfg.StrOpt('agent_mode', default=constants.L3_AGENT_MODE_LEGACY,
+               choices=(constants.L3_AGENT_MODE_DVR,
+                        constants.L3_AGENT_MODE_DVR_SNAT,
+                        constants.L3_AGENT_MODE_LEGACY),
                help=_("The working mode for the agent. Allowed modes are: "
                       "'legacy' - this preserves the existing behavior "
                       "where the L3 agent is deployed on a centralized "
index 4a7fe3e47cf3a037d2c02417bfaac1f1fe2a4a18..dc34b93d18e700c59a64593f576ebeeef04b9b69 100644 (file)
@@ -17,6 +17,7 @@ import os
 
 from oslo_config import cfg
 
+from neutron.agent.linux import keepalived
 from neutron.common import constants as l3_constants
 from neutron.i18n import _LE
 from neutron.openstack.common import log as logging
@@ -33,7 +34,8 @@ OPTS = [
                       'config files')),
     cfg.StrOpt('ha_vrrp_auth_type',
                default='PASS',
-               help=_('VRRP authentication type AH/PASS')),
+               choices=keepalived.VALID_AUTH_TYPES,
+               help=_('VRRP authentication type')),
     cfg.StrOpt('ha_vrrp_auth_password',
                help=_('VRRP authentication password'),
                secret=True),
index 39c618ca6397195d05dd1d0b308ab4d0dd208699..341553834ecbd7f019e6fa6fbebec35567ad404a 100644 (file)
@@ -26,8 +26,8 @@ eswitch_opts = [
                 help=_("List of <physical_network>:<physical_interface>")),
     cfg.StrOpt('vnic_type',
                default=constants.VIF_TYPE_DIRECT,
-               help=_("Type of VM network interface: mlnx_direct or "
-                      "hostdev")),
+               choices=(constants.VIF_TYPE_DIRECT, constants.VIF_TYPE_HOSTDEV),
+               help=_("Type of VM network interface")),
     cfg.StrOpt('daemon_endpoint',
                default='tcp://127.0.0.1:60001',
                help=_('eswitch daemon end point')),
index 281bac55731e83b1ae447acb2e3613aff697172f..89b5eeb7181876941fa38b792b31bb60632223e2 100644 (file)
@@ -61,9 +61,9 @@ base_opts = [
                       "does not support namespaces otherwise access_network "
                       "should be used.")),
     cfg.StrOpt('default_transport_type', default='stt',
+               choices=('stt', 'gre', 'bridge', 'ipsec_gre', 'ipsec_stt'),
                deprecated_group='NVP',
-               help=_("The default network tranport type to use (stt, gre, "
-                      "bridge, ipsec_gre, or ipsec_stt)")),
+               help=_("The default network transport type to use")),
     cfg.StrOpt('agent_mode', default=AgentModes.AGENT,
                deprecated_group='NVP',
                help=_("The mode used to implement DHCP/metadata services.")),