]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use oslo_config new type PortOpt for port options
authorchenying <ying.chen@huawei.com>
Tue, 10 Nov 2015 07:17:57 +0000 (15:17 +0800)
committerchenying <ying.chen@huawei.com>
Wed, 11 Nov 2015 01:52:30 +0000 (09:52 +0800)
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

12 files changed:
cinder/service.py
cinder/tests/unit/zonemanager/test_brcd_fc_san_lookup_service.py
cinder/tests/unit/zonemanager/test_cisco_fc_san_lookup_service.py
cinder/volume/driver.py
cinder/volume/drivers/dell/dell_storagecenter_common.py
cinder/volume/drivers/prophetstor/options.py
cinder/volume/drivers/remotefs.py
cinder/volume/drivers/san/san.py
cinder/volume/drivers/sheepdog.py
cinder/volume/drivers/solidfire.py
cinder/zonemanager/drivers/brocade/brcd_fabric_opts.py
cinder/zonemanager/drivers/cisco/cisco_fabric_opts.py

index 36dc390ba326e64803182564c930738743571b09..237bae211d3aa18997a1dcbf49264c56a95a08b6 100644 (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.'), ]
index df208ee3556aaddc70976a79298386c5d193c656..a42b7bb048a75323bca3b58d4cd81b9a8a7e6b46 100644 (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')
index ff353b6b8d6f3197ffd08726a3cb0009b88a5e37..6ca16d33fd7c08f6b48969f22e632371408de178 100644 (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')
index bb6d08e69e488e38d9a44a4703198d630799594e..9feed14540e650db1cc95db8e5dc1252a71a43bf 100644 (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'),
index 46299d3470bfdd45e62b7db34173a4dfb5582cd6..61b66dee456515528cd5795a554ae1edf5423b37 100644 (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'),
index ff9768f7fe2eba308f1c4b4651444cb67a55edff..ec7364dda4d2126ed26b78ba84a40bd573fed956 100644 (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
index 4bb5d65af67a709a64c4e2ca634525ed02fdb43a..cc27c46df8cea892cf8ca3e978e30c73443a0442 100644 (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.'),
index 6c6df1cc45c00af0775acbef714b681bfcac3eb2..e6946fdd6aacf565b1c5c3f3813ec7e21f9267af 100644 (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; '
index b41c1b26e776caf34dd7a0a424621316ed85d546..f29a61acb8af42014ed87c400d9304a224aa4ef1 100644 (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
index d18ec5c27dc97b6786d8ea581e25d851e3ac0f40..0bac423a9c43b3e27ce3e91355bf4a476b60c36e 100644 (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)
index ec311f87b722eee7ca93763cfc42c593954087b0..1328bb1ba776339651569c1a96ba178372e76758 100644 (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'),
index b29b408d5ddd8764dcdca88c812d34f253784d54..524dcc1e9a616c0ff179886bdecf73b0c182b128 100644 (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'),