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
This commit is contained in:
wanghao 2017-03-30 21:34:28 +08:00
parent 10cd7a8e04
commit 4608a9df43

View File

@ -45,9 +45,9 @@ core_opts = [
CONF.register_cli_opts(core_opts) CONF.register_cli_opts(core_opts)
global_opts = [ global_opts = [
cfg.StrOpt('my_ip', cfg.HostAddressOpt('my_ip',
default=netutils.get_my_ipv4(), default=netutils.get_my_ipv4(),
help='IP address of this host'), help='IP address of this host'),
cfg.ListOpt('glance_api_servers', cfg.ListOpt('glance_api_servers',
default=None, default=None,
help='A list of the URLs of glance API servers available to ' help='A list of the URLs of glance API servers available to '
@ -113,10 +113,11 @@ global_opts = [
cfg.StrOpt('scheduler_manager', cfg.StrOpt('scheduler_manager',
default='cinder.scheduler.manager.SchedulerManager', default='cinder.scheduler.manager.SchedulerManager',
help='Full class name for the Manager for scheduler'), help='Full class name for the Manager for scheduler'),
cfg.StrOpt('host', cfg.HostAddressOpt('host',
default=socket.gethostname(), default=socket.gethostname(),
help='Name of this node. This can be an opaque identifier. ' help='Name of this node. This can be an opaque '
'It is not necessarily a host name, FQDN, or IP address.'), 'identifier. It is not necessarily a host name, '
'FQDN, or IP address.'),
# NOTE(vish): default to nova for compatibility with nova installs # NOTE(vish): default to nova for compatibility with nova installs
cfg.StrOpt('storage_availability_zone', cfg.StrOpt('storage_availability_zone',
default='nova', default='nova',