From: ZhiQiang Fan Date: Thu, 22 Oct 2015 06:12:24 +0000 (-0600) Subject: Use oslo_config new type PortOpt for port options X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4d2cb851b7b7d6399163ca9f624f656a3e41ac34;p=openstack-build%2Fneutron-build.git Use oslo_config new type PortOpt for port options The oslo_config library provides new type PortOpt to validate the range of port now. Change-Id: I40792ddcee0f89c47defa726fed24f26c4b88ce2 Depends-On: I9c0e3f44cf93db020933d8d766cedfc2e3f3bb8b --- diff --git a/neutron/agent/l3/config.py b/neutron/agent/l3/config.py index ce0def645..56f1cfd8e 100644 --- a/neutron/agent/l3/config.py +++ b/neutron/agent/l3/config.py @@ -41,10 +41,10 @@ OPTS = [ help=_("Name of bridge used for external network " "traffic. This option is deprecated and will be removed " "in the M release.")), - cfg.IntOpt('metadata_port', - default=9697, - help=_("TCP Port used by Neutron metadata namespace " - "proxy.")), + cfg.PortOpt('metadata_port', + default=9697, + help=_("TCP Port used by Neutron metadata namespace " + "proxy.")), cfg.IntOpt('send_arp_for_ha', default=3, help=_("Send this many gratuitous ARPs for HA setup, if " diff --git a/neutron/agent/metadata/config.py b/neutron/agent/metadata/config.py index eddc05c92..bfc211041 100644 --- a/neutron/agent/metadata/config.py +++ b/neutron/agent/metadata/config.py @@ -55,9 +55,9 @@ METADATA_PROXY_HANDLER_OPTS = [ "file for ssl")), cfg.StrOpt('nova_metadata_ip', default='127.0.0.1', help=_("IP address used by Nova metadata server.")), - cfg.IntOpt('nova_metadata_port', - default=8775, - help=_("TCP Port used by Nova metadata server.")), + cfg.PortOpt('nova_metadata_port', + default=8775, + help=_("TCP Port used by Nova metadata server.")), cfg.StrOpt('metadata_proxy_shared_secret', default='', help=_('Shared secret to sign instance-id request'), diff --git a/neutron/agent/metadata/namespace_proxy.py b/neutron/agent/metadata/namespace_proxy.py index 3aa62aff0..ed87871c0 100644 --- a/neutron/agent/metadata/namespace_proxy.py +++ b/neutron/agent/metadata/namespace_proxy.py @@ -149,10 +149,10 @@ def main(): cfg.BoolOpt('daemonize', default=True, help=_('Run as daemon.')), - cfg.IntOpt('metadata_port', - default=9697, - help=_("TCP Port to listen for metadata server " - "requests.")), + cfg.PortOpt('metadata_port', + default=9697, + help=_("TCP Port to listen for metadata server " + "requests.")), cfg.StrOpt('metadata_proxy_socket', default='$state_path/metadata_proxy', help=_('Location of Metadata Proxy UNIX domain ' diff --git a/neutron/common/config.py b/neutron/common/config.py index 973973203..894bd7af4 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -39,8 +39,8 @@ LOG = logging.getLogger(__name__) core_opts = [ cfg.StrOpt('bind_host', default='0.0.0.0', help=_("The host IP to bind to")), - cfg.IntOpt('bind_port', default=9696, - help=_("The port to bind to")), + cfg.PortOpt('bind_port', default=9696, + help=_("The port to bind to")), cfg.StrOpt('api_extensions_path', default="", help=_("The path for API extensions")), cfg.StrOpt('auth_strategy', default='keystone', diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py b/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py index 5fcdb5623..edc51326b 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py @@ -56,8 +56,8 @@ ovs_opts = [ cfg.IPOpt('of_listen_address', default='127.0.0.1', help=_("Address to listen on for OpenFlow connections. " "Used only for 'native' driver.")), - cfg.IntOpt('of_listen_port', default=6633, - help=_("Port to listen on for OpenFlow connections. " + cfg.PortOpt('of_listen_port', default=6633, + help=_("Port to listen on for OpenFlow connections. " "Used only for 'native' driver.")), cfg.IntOpt('of_connect_timeout', default=30, help=_("Timeout in seconds to wait for " @@ -84,8 +84,8 @@ agent_opts = [ cfg.ListOpt('tunnel_types', default=DEFAULT_TUNNEL_TYPES, help=_("Network types supported by the agent " "(gre and/or vxlan).")), - cfg.IntOpt('vxlan_udp_port', default=p_const.VXLAN_UDP_PORT, - help=_("The UDP port to use for VXLAN tunnels.")), + cfg.PortOpt('vxlan_udp_port', default=p_const.VXLAN_UDP_PORT, + help=_("The UDP port to use for VXLAN tunnels.")), cfg.IntOpt('veth_mtu', help=_("MTU size of veth interfaces")), cfg.BoolOpt('l2_population', default=False,