diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index 169cdda017c..707b31124a9 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.