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
This commit is contained in:
Cedric Brandily 2017-02-22 09:02:52 +01:00
parent e6557fc0d7
commit 366dd7cc37
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.