From 0a7ce3b2d77b4685cc293a39984805d12d3fd24a Mon Sep 17 00:00:00 2001 From: luqitao Date: Fri, 17 Mar 2017 01:59:13 -0400 Subject: [PATCH] Use HostAddressOpt for opts that accept IP and hostnames Some configuration options were accepting both IP addresses and hostnames. Since there was no specific OSLO opt type to support this, we were using ``StrOpt``. The change [1] that added support for ``HostAddressOpt`` type was merged in Ocata and became available for use with oslo version 3.22. This patch changes the opt type of configuration options to use this more relevant opt type - HostAddressOpt. [1] I77bdb64b7e6e56ce761d76696bc4448a9bd325eb Change-Id: Ia5df1e10dbe76040b89b989b8914b2a9b77ad856 --- cinder/service.py | 7 ++++--- cinder/volume/driver.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cinder/service.py b/cinder/service.py index e805021fc84..8280cac5cd4 100644 --- a/cinder/service.py +++ b/cinder/service.py @@ -67,9 +67,10 @@ service_opts = [ help='Range, in seconds, to randomly delay when starting the' ' periodic task scheduler to reduce stampeding.' ' (Disable by setting to 0)'), - cfg.StrOpt('osapi_volume_listen', - default="0.0.0.0", - help='IP address on which OpenStack Volume API listens'), + cfg.HostAddressOpt('osapi_volume_listen', + default="0.0.0.0", + help='IP address on which OpenStack Volume API ' + 'listens'), cfg.PortOpt('osapi_volume_listen_port', default=8776, help='Port on which OpenStack Volume API listens'), diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index e154249dcc3..0f8a36f63dd 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -49,9 +49,10 @@ volume_opts = [ cfg.StrOpt('iscsi_target_prefix', default='iqn.2010-10.org.openstack:', help='Prefix for iSCSI volumes'), - cfg.StrOpt('iscsi_ip_address', - default='$my_ip', - help='The IP address that the iSCSI daemon is listening on'), + cfg.HostAddressOpt('iscsi_ip_address', + default='$my_ip', + help='The IP address that the iSCSI daemon is ' + 'listening on'), cfg.ListOpt('iscsi_secondary_ip_addresses', default=[], help='The list of secondary IP addresses of the iSCSI daemon'), @@ -282,9 +283,10 @@ iser_opts = [ cfg.StrOpt('iser_target_prefix', default='iqn.2010-10.org.openstack:', help='Prefix for iSER volumes'), - cfg.StrOpt('iser_ip_address', - default='$my_ip', - help='The IP address that the iSER daemon is listening on'), + cfg.HostAddressOpt('iser_ip_address', + default='$my_ip', + help='The IP address that the iSER daemon is ' + 'listening on'), cfg.PortOpt('iser_port', default=3260, help='The port that the iSER daemon is listening on'),