On Mon, 2020-11-30 at 11:51 +0000, Stephen Finucane wrote:
When attaching a port to an instance, nova will check for DNS support in neutron and set a 'dns_name' attribute if found. To populate this attribute, nova uses a sanitised version of the instance name, stored in the instance.hostname attribute. This sanitisation simply strips out any unicode characters and replaces underscores and spaces with dashes, before truncating to 63 characters. It does not currently replace periods and this is the cause of bug 1581977 [1], where an instance name such as 'ubuntu20.04' will fail to schedule since neutron identifies '04' as an invalid TLD.
The question now is what to do to resolve this. There are two obvious paths available to us. The first is to simply catch these invalid hostnames and replace them with an arbitrary hostname of format 'Server-{serverUUID}'. This is what we currently do for purely unicode instance names and is what I've proposed at [2]. The other option is to strip all periods, or rather replace them with hyphens, when sanitizing the instance name. This is more predictable but breaks the ability to use the instance name as a FQDN. Such usage is something I'm told we've never supported, but I'm concerned that there are users out there who are relying on this all the same and I'd like to get a feel for whether this is the case first.
So, the question: does anyone currently rely on this inadvertent "feature"?
A quick update. I've reworked the change [1] such that it will always replace periods with hyphens. From the sounds of things, there are people who name their instance using FQDNs for management purposes but there does not appear to be anyone using the name published via the metadata service for DNS integration purposes. This makes replacing the periods the least complex solution to the immediate issue. A future change can look at exposing a way to configure this information via the API when creating a new instance. We might also want to change from stripping of unicode to replacement using punycode. If anyone missed this discussion the first time around and has concerns, please raise them here or on the review. Cheers, Stephen [1] https://review.opendev.org/c/openstack/nova/+/764482
Cheers, Stephen
[1] https://launchpad.net/bugs/1581977 [2] https://review.opendev.org/c/openstack/nova/+/764482