From 366dd7cc37c053e0fff897b16414c960243abcfc Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Wed, 22 Feb 2017 09:02:52 +0100 Subject: [PATCH] Deprecate nova_metadata_ip in favor of nova_metadata_host option nova_metadata_ip option name is a bit confusing as it accepts an ip but also a dns name (which is required when https protocol is used). This change deprecates nova_metadata_ip option in favor of nova_metadata_host option and updates option help to highlight that we can use an ip or a dns name. DocImpact Closes-Bug: #1585699 Change-Id: Ia6c2471c7b4f3e924941222133edbb90151757a5 --- neutron/agent/metadata/agent.py | 10 +++++----- neutron/conf/agent/metadata/config.py | 5 +++-- neutron/tests/unit/agent/metadata/test_agent.py | 4 ++-- .../rename-to-nova-metadata-ip-685fd81618c16d9d.yaml | 6 ++++++ 4 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/rename-to-nova-metadata-ip-685fd81618c16d9d.yaml diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index a2362af65d3..22fcac22230 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -172,11 +172,11 @@ class MetadataProxyHandler(object): 'X-Instance-ID-Signature': self._sign_instance_id(instance_id) } - nova_ip_port = '%s:%s' % (self.conf.nova_metadata_ip, - self.conf.nova_metadata_port) + nova_host_port = '%s:%s' % (self.conf.nova_metadata_host, + self.conf.nova_metadata_port) url = urlparse.urlunsplit(( self.conf.nova_metadata_protocol, - nova_ip_port, + nova_host_port, req.path_info, req.query_string, '')) @@ -188,7 +188,7 @@ class MetadataProxyHandler(object): if self.conf.nova_client_cert and self.conf.nova_client_priv_key: h.add_certificate(self.conf.nova_client_priv_key, self.conf.nova_client_cert, - nova_ip_port) + nova_host_port) resp, content = h.request(url, method=req.method, headers=headers, body=req.body) @@ -242,7 +242,7 @@ class UnixDomainMetadataProxy(object): 'topic': 'N/A', 'configurations': { 'metadata_proxy_socket': cfg.CONF.metadata_proxy_socket, - 'nova_metadata_ip': cfg.CONF.nova_metadata_ip, + 'nova_metadata_host': cfg.CONF.nova_metadata_host, 'nova_metadata_port': cfg.CONF.nova_metadata_port, 'log_agent_heartbeats': cfg.CONF.AGENT.log_agent_heartbeats, }, diff --git a/neutron/conf/agent/metadata/config.py b/neutron/conf/agent/metadata/config.py index 5f521f4e7e0..d2f8962452e 100644 --- a/neutron/conf/agent/metadata/config.py +++ b/neutron/conf/agent/metadata/config.py @@ -58,8 +58,9 @@ METADATA_PROXY_HANDLER_OPTS = [ cfg.StrOpt('auth_ca_cert', help=_("Certificate Authority public key (CA cert) " "file for ssl")), - cfg.StrOpt('nova_metadata_ip', default='127.0.0.1', - help=_("IP address used by Nova metadata server.")), + 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.PortOpt('nova_metadata_port', default=8775, help=_("TCP Port used by Nova metadata server.")), diff --git a/neutron/tests/unit/agent/metadata/test_agent.py b/neutron/tests/unit/agent/metadata/test_agent.py index 7dcab866d85..591d56d7644 100644 --- a/neutron/tests/unit/agent/metadata/test_agent.py +++ b/neutron/tests/unit/agent/metadata/test_agent.py @@ -36,7 +36,7 @@ class ConfFixture(config_fixture.Config): meta_conf.register_meta_conf_opts( meta_conf.METADATA_PROXY_HANDLER_OPTS, self.conf) self.config(auth_ca_cert=None, - nova_metadata_ip='9.9.9.9', + nova_metadata_host='9.9.9.9', nova_metadata_port=8775, metadata_proxy_shared_secret='secret', nova_metadata_protocol='http', @@ -362,7 +362,7 @@ class _TestMetadataProxyHandlerCacheMixin(object): mock.call().add_certificate( self.fake_conf.nova_client_priv_key, self.fake_conf.nova_client_cert, - "%s:%s" % (self.fake_conf.nova_metadata_ip, + "%s:%s" % (self.fake_conf.nova_metadata_host, self.fake_conf.nova_metadata_port) ), mock.call().request( diff --git a/releasenotes/notes/rename-to-nova-metadata-ip-685fd81618c16d9d.yaml b/releasenotes/notes/rename-to-nova-metadata-ip-685fd81618c16d9d.yaml new file mode 100644 index 00000000000..d0f6e484575 --- /dev/null +++ b/releasenotes/notes/rename-to-nova-metadata-ip-685fd81618c16d9d.yaml @@ -0,0 +1,6 @@ +deprecations: + - | + The ``nova_metadata_ip`` option is deprecated and will be removed in + Queens. It is deprecated in favor of the new ``nova_metadata_host`` option + because it reflects better that the option accepts an IP address and also + a DNS name.