From 4608a9df43f9baedded8f811afaecc76ed9fb008 Mon Sep 17 00:00:00 2001 From: wanghao Date: Thu, 30 Mar 2017 21:34:28 +0800 Subject: [PATCH] Support for HostAddress opt Since Oslo has introduced the new opt HostAddress opt[1]. This would ensure that an invalid IP does not pass as a valid hostname and at the same time retains the rules required to be followed for the validation of an acceptable hostname. [1]:https://review.openstack.org/#/c/358045/ Change-Id: I8cb46f6a55cbece5cecce495de76b6ff06459470 --- cinder/common/config.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cinder/common/config.py b/cinder/common/config.py index 2974e82085e..ff5074f0c6f 100644 --- a/cinder/common/config.py +++ b/cinder/common/config.py @@ -45,9 +45,9 @@ core_opts = [ CONF.register_cli_opts(core_opts) global_opts = [ - cfg.StrOpt('my_ip', - default=netutils.get_my_ipv4(), - help='IP address of this host'), + cfg.HostAddressOpt('my_ip', + default=netutils.get_my_ipv4(), + help='IP address of this host'), cfg.ListOpt('glance_api_servers', default=None, help='A list of the URLs of glance API servers available to ' @@ -113,10 +113,11 @@ global_opts = [ cfg.StrOpt('scheduler_manager', default='cinder.scheduler.manager.SchedulerManager', help='Full class name for the Manager for scheduler'), - cfg.StrOpt('host', - default=socket.gethostname(), - help='Name of this node. This can be an opaque identifier. ' - 'It is not necessarily a host name, FQDN, or IP address.'), + cfg.HostAddressOpt('host', + default=socket.gethostname(), + help='Name of this node. This can be an opaque ' + 'identifier. It is not necessarily a host name, ' + 'FQDN, or IP address.'), # NOTE(vish): default to nova for compatibility with nova installs cfg.StrOpt('storage_availability_zone', default='nova',