Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utils: Remove periods from instance hostnames
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
- Loading branch information