Use oslo_config new type PortOpt for port options

The oslo_config library provides new type PortOpt to validate the
range of port now.
ref: https://github.com/openstack/oslo.config/blob/2.6.0/oslo_config/cfg.py#L1114

DocImpact
Change-Id: I9a3e4d13feef67b4a43936c6099b822e4f1f6a57
Closes-Bug: #1514702
This commit is contained in:
chenying 2015-11-10 15:17:57 +08:00
parent 8e03c3b335
commit 7ef20e1b91
12 changed files with 38 additions and 50 deletions

View File

@ -62,10 +62,9 @@ service_opts = [
cfg.StrOpt('osapi_volume_listen',
default="0.0.0.0",
help='IP address on which OpenStack Volume API listens'),
cfg.IntOpt('osapi_volume_listen_port',
default=8776,
min=1, max=65535,
help='Port on which OpenStack Volume API listens'),
cfg.PortOpt('osapi_volume_listen_port',
default=8776,
help='Port on which OpenStack Volume API listens'),
cfg.IntOpt('osapi_volume_workers',
help='Number of workers for OpenStack Volume API service. '
'The default is equal to the number of CPUs available.'), ]

View File

@ -93,8 +93,8 @@ class TestBrcdFCSanLookupService(brcd_lookup.BrcdFCSanLookupService,
fc_fabric_opts.append(cfg.StrOpt('fc_fabric_password',
default='password', help='',
secret=True))
fc_fabric_opts.append(cfg.IntOpt('fc_fabric_port',
default=22, help=''))
fc_fabric_opts.append(cfg.PortOpt('fc_fabric_port',
default=22, help=''))
fc_fabric_opts.append(cfg.StrOpt('principal_switch_wwn',
default='100000051e55a100', help=''))
config = conf.Configuration(fc_fabric_opts, 'BRCD_FAB_2')

View File

@ -70,8 +70,8 @@ class TestCiscoFCSanLookupService(cisco_lookup.CiscoFCSanLookupService,
fc_fabric_opts.append(cfg.StrOpt('cisco_fc_fabric_password',
default='admin1234', help='',
secret=True))
fc_fabric_opts.append(cfg.IntOpt('cisco_fc_fabric_port',
default=22, help=''))
fc_fabric_opts.append(cfg.PortOpt('cisco_fc_fabric_port',
default=22, help=''))
fc_fabric_opts.append(cfg.StrOpt('cisco_zoning_vsan',
default='304', help=''))
config = conf.Configuration(fc_fabric_opts, 'CISCO_FAB_2')

View File

@ -58,10 +58,9 @@ volume_opts = [
cfg.ListOpt('iscsi_secondary_ip_addresses',
default=[],
help='The list of secondary IP addresses of the iSCSI daemon'),
cfg.IntOpt('iscsi_port',
default=3260,
min=1, max=65535,
help='The port that the iSCSI daemon is listening on'),
cfg.PortOpt('iscsi_port',
default=3260,
help='The port that the iSCSI daemon is listening on'),
cfg.IntOpt('num_volume_device_scan_tries',
default=3,
help='The maximum number of times to rescan targets'
@ -258,10 +257,9 @@ iser_opts = [
cfg.StrOpt('iser_ip_address',
default='$my_ip',
help='The IP address that the iSER daemon is listening on'),
cfg.IntOpt('iser_port',
default=3260,
min=1, max=65535,
help='The port that the iSER daemon is listening on'),
cfg.PortOpt('iser_port',
default=3260,
help='The port that the iSER daemon is listening on'),
cfg.StrOpt('iser_helper',
default='tgtadm',
help='The name of the iSER target user-land tool to use'),

View File

@ -29,10 +29,9 @@ common_opts = [
cfg.IntOpt('dell_sc_ssn',
default=64702,
help='Storage Center System Serial Number'),
cfg.IntOpt('dell_sc_api_port',
default=3033,
min=1, max=65535,
help='Dell API port'),
cfg.PortOpt('dell_sc_api_port',
default=3033,
help='Dell API port'),
cfg.StrOpt('dell_sc_server_folder',
default='openstack',
help='Name of the server folder to use on the Storage Center'),

View File

@ -21,10 +21,9 @@ DPL_OPTS = [
cfg.StrOpt('dpl_pool',
default='',
help='DPL pool uuid in which DPL volumes are stored.'),
cfg.IntOpt('dpl_port',
default=8357,
min=1, max=65535,
help='DPL port number.'),
cfg.PortOpt('dpl_port',
default=8357,
help='DPL port number.'),
]
CONF = cfg.CONF

View File

@ -49,10 +49,9 @@ nas_opts = [
default='',
help='Password to connect to NAS system.',
secret=True),
cfg.IntOpt('nas_ssh_port',
default=22,
min=1, max=65535,
help='SSH port to use to connect to NAS system.'),
cfg.PortOpt('nas_ssh_port',
default=22,
help='SSH port to use to connect to NAS system.'),
cfg.StrOpt('nas_private_key',
default='',
help='Filename of private key to use for SSH authentication.'),

View File

@ -55,10 +55,9 @@ san_opts = [
cfg.StrOpt('san_clustername',
default='',
help='Cluster name to use for creating volumes'),
cfg.IntOpt('san_ssh_port',
default=22,
min=1, max=65535,
help='SSH port to use with SAN'),
cfg.PortOpt('san_ssh_port',
default=22,
help='SSH port to use with SAN'),
cfg.BoolOpt('san_is_local',
default=False,
help='Execute commands locally instead of over SSH; '

View File

@ -43,10 +43,9 @@ sheepdog_opts = [
cfg.StrOpt('sheepdog_store_address',
default='127.0.0.1',
help=('IP address of sheep daemon.')),
cfg.IntOpt('sheepdog_store_port',
min=1, max=65535,
default=7000,
help=('Port of sheep daemon.'))
cfg.PortOpt('sheepdog_store_port',
default=7000,
help=('Port of sheep daemon.'))
]
CONF = cfg.CONF

View File

@ -84,12 +84,10 @@ sf_opts = [
'memory, very large deployments may want to consider '
'setting to False.'),
cfg.IntOpt('sf_api_port',
default=443,
min=1, max=65535,
help='SolidFire API port. Useful if the device api is behind '
'a proxy on a different port.')]
cfg.PortOpt('sf_api_port',
default=443,
help='SolidFire API port. Useful if the device api is behind '
'a proxy on a different port.')]
CONF = cfg.CONF
CONF.register_opts(sf_opts)

View File

@ -31,10 +31,9 @@ brcd_zone_opts = [
default='',
help='Password for user',
secret=True),
cfg.IntOpt('fc_fabric_port',
default=22,
min=1, max=65535,
help='Connecting port'),
cfg.PortOpt('fc_fabric_port',
default=22,
help='Connecting port'),
cfg.StrOpt('zoning_policy',
default='initiator-target',
help='overridden zoning policy'),

View File

@ -28,10 +28,9 @@ cisco_zone_opts = [
default='',
help='Password for user',
secret=True),
cfg.IntOpt('cisco_fc_fabric_port',
default=22,
min=1, max=65535,
help='Connecting port'),
cfg.PortOpt('cisco_fc_fabric_port',
default=22,
help='Connecting port'),
cfg.StrOpt('cisco_zoning_policy',
default='initiator-target',
help='overridden zoning policy'),