From 957ab703c009c73cce990907e48850e17b695c6d Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Mon, 24 Aug 2015 09:15:47 -0700 Subject: [PATCH] Use min and max on IntOpt option types Latest version of oslo.config support the ability to set valid range on IntOpt option values. This patch makes use of that feature for a number of options with well known minimum and maximum values. Change-Id: I4f20adbd0140e312f9cde86f71000c3dbd6aaf19 --- vmware_nsx/neutron/plugins/vmware/common/config.py | 4 +++- vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py | 1 + vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/neutron/plugins/vmware/common/config.py b/vmware_nsx/neutron/plugins/vmware/common/config.py index bea9e24108..de5e16f47a 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/config.py +++ b/vmware_nsx/neutron/plugins/vmware/common/config.py @@ -239,8 +239,9 @@ nsxv_opts = [ help=_('DVS ID for VLANs')), cfg.IntOpt('maximum_tunnels_per_vnic', default=DEFAULT_MAXIMUM_TUNNELS_PER_VNIC, + min=1, max=110, help=_('Maximum number of sub interfaces supported ' - 'per vnic in edge. The value should be in 1-110.')), + 'per vnic in edge.')), cfg.ListOpt('backup_edge_pool', default=['service:large:4:10', 'service:compact:4:10', @@ -266,6 +267,7 @@ nsxv_opts = [ help=_('IP addresses used by Nova metadata service')), cfg.IntOpt('nova_metadata_port', default=8775, + min=1, max=65535, help=_("TCP Port used by Nova metadata server")), cfg.StrOpt('metadata_shared_secret', secret=True, diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py index 7c89ce6c28..1ef0dedd05 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py @@ -57,6 +57,7 @@ metadata_opts = [ cfg.IntOpt('metadata_server_port', deprecated_group='NVP_METADATA', default=8775, + min=1, max=65535, help=_("TCP Port used by Metadata server.")), cfg.StrOpt('metadata_shared_secret', deprecated_group='NVP_METADATA', diff --git a/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py b/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py index 30c8047659..8a7bb121ed 100644 --- a/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py +++ b/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py @@ -19,7 +19,7 @@ dvs_opts = [ cfg.StrOpt('host_ip', help='Hostname or IP address for connection to VMware vCenter ' 'host.'), - cfg.IntOpt('host_port', default=443, + cfg.IntOpt('host_port', default=443, min=1, max=65535, help='Port for connection to VMware vCenter host.'), cfg.StrOpt('host_username', help='Username for connection to VMware vCenter host.'),