From ac799dc016f6d5d30b46087c6f0a82ac01cb5be3 Mon Sep 17 00:00:00 2001 From: luqitao Date: Thu, 16 Mar 2017 06:13:48 -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 TrivialFix Change-Id: I5a564efc189c062cc3a780aef1baf32b28914b39 --- neutron/conf/agent/metadata/config.py | 8 +++++--- neutron/conf/common.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/neutron/conf/agent/metadata/config.py b/neutron/conf/agent/metadata/config.py index b73f55c4c42..fe044f69c61 100644 --- a/neutron/conf/agent/metadata/config.py +++ b/neutron/conf/agent/metadata/config.py @@ -44,9 +44,11 @@ cfg.StrOpt('auth_ca_cert', help=_("Certificate Authority public key (CA cert) " "file for ssl")), - cfg.StrOpt('nova_metadata_host', default='127.0.0.1', - deprecated_name='nova_metadata_ip', - help=_("IP address or DNS name of Nova metadata server.")), + cfg.HostAddressOpt('nova_metadata_host', + default='127.0.0.1', + deprecated_name='nova_metadata_ip', + help=_("IP address or DNS name of Nova metadata " + "server.")), cfg.PortOpt('nova_metadata_port', default=8775, help=_("TCP Port used by Nova metadata server.")), diff --git a/neutron/conf/common.py b/neutron/conf/common.py index b7715a8fc71..8c37986b91b 100644 --- a/neutron/conf/common.py +++ b/neutron/conf/common.py @@ -22,8 +22,8 @@ core_opts = [ - cfg.StrOpt('bind_host', default='0.0.0.0', - help=_("The host IP to bind to")), + cfg.HostAddressOpt('bind_host', default='0.0.0.0', + help=_("The host IP to bind to.")), cfg.PortOpt('bind_port', default=9696, help=_("The port to bind to")), cfg.StrOpt('api_extensions_path', default="", @@ -96,12 +96,12 @@ "Attention: the following parameter MUST be set to " "False if Neutron is being used in conjunction with " "Nova security groups.")), - cfg.StrOpt('host', default=net.get_hostname(), - sample_default='example.domain', - help=_("Hostname to be used by the Neutron server, agents and " - "services running on this machine. All the agents and " - "services running on this machine must use the same " - "host value.")), + cfg.HostAddressOpt('host', default=net.get_hostname(), + sample_default='example.domain', + help=_("Hostname to be used by the Neutron server, " + "agents and services running on this machine. " + "All the agents and services running on this " + "machine must use the same host value.")), cfg.StrOpt("network_link_prefix", help=_("This string is prepended to the normal URL that is " "returned in links to the OpenStack Network API. If it "