
When creating an instance, nova sanitizes the 'instance.name' attribute, using the 'nova.utils.sanitize_hostname' function, and stores this as the 'instance.hostname' attribute. If neutron has the DNS extension enabled then this attribute will be reported as the 'dns_name' value when attaching ports [1]. Nova does not currently remove or replace periods in the name as part of this sanitization. This results in the hostname being identified as a (FQDN) fully qualified domain name, with all the constraints placed on FQDNs [2]. This can be problematic for instances with common names such as 'ubuntu18.04' or 'test.a', which aren't valid since TLDs must start with an alpha character and must be greater than 1 character long, respectively. Attempting to boot instances with such names can result in failures like the below when DNS integration is enabled in neutron: RescheduledException: Build of instance foo was re-scheduled: Invalid input for dns_name. Reason: 'test-ubuntu-20.04' not a valid PQDN or FQDN. Reason: TLD '04' must not be all numeric. Start replacing these periods with hyphens. This is a change in behavior and may affect users who are relying on this inadvertent support for instance names as FQDNs when using cloud-init, however, a quick poll on openstack-discuss [3] suggests the people that are using FQDN-like instance names are setting hostnames in the guest explicitly and not relying on the information provided via the nova metadata service, meaning this will not affect them. [1] https://docs.openstack.org/neutron/victoria/admin/config-dns-int.html [2] https://stackoverflow.com/a/53875771/613428 [3] http://lists.openstack.org/pipermail/openstack-discuss/2020-November/019113.html Change-Id: I2fac7f919e9ddd6b0925d3e5d04e61b2ba1b8c82 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Closes-Bug: #1581977
25 lines
1.5 KiB
YAML
25 lines
1.5 KiB
YAML
---
|
|
fixes:
|
|
- |
|
|
Nova will now replace periods (``.``) with dashes (``-``) when santizing an
|
|
instance's display name for use as a hostname.
|
|
|
|
Nova publishes hostnames for instances via the metadata service and config
|
|
drives. This hostname is based on a sanitized version of the instance name
|
|
combined with the domain value specified in ``[api] dhcp_domain``. The
|
|
previous sanitization of the hostname included the replacement of whitespace
|
|
and underscores with dashes and the stripping of unicode characters along
|
|
with leading and trailing periods and dashes. It did not, however, include
|
|
the removal of periods in the name. Periods are not valid in the hostname
|
|
or, more specifically, in the host-specific or leaf label (the ``host`` in
|
|
``host.example.com``) and their presence can cause conflicts when ``[api]
|
|
dhcp_domain`` is configured, leading to instances being mistakenly
|
|
configured with hostnames like ``host.example.com.example.com``. More
|
|
pressingly, their use can result in a failure to boot instances if DNS
|
|
integration is enabled in neutron, likely via designate, as the hostname is
|
|
identified as a FQDN (fully-qualified domain name) by neutron and reasonable
|
|
instance names like ``test-ubuntu20.04`` will be rejected as invalid FQDNs,
|
|
in this case because the name would yield a TLD (top-level domain) of ``04``
|
|
and TLDs cannot be entire numerical. To avoid these issues, periods are now
|
|
replaced with dashes.
|