Merge "Deprecate nova_metadata_ip in favor of nova_metadata_host option"

This commit is contained in:
Jenkins 2017-03-04 03:55:40 +00:00 committed by Gerrit Code Review
commit b34f705536
4 changed files with 16 additions and 9 deletions

View File

@ -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,
},

View File

@ -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.")),

View File

@ -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(

View File

@ -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.