← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1614148] [NEW] sanitize_hostname() fails to account for domain part

 

Public bug reported:

The function nova.utils.sanitize_hostname() sanitizes instance names to
make them suitable for use as host names. Among other things it contains
the function truncate_hostname() that truncates host names to a maximum
length of 63 characters. Unfortunately this truncation does not take
into account the host names' domain part (DEFAULT/dhcp_domain in
nova.conf).

Consequently, a 63 character host name plus a domain part (e.g.
`.novalocal`) will yield a 73 character net host name passed to
cloud-init inside the instance, which can cause problems with host name
setting code (this can prevent instances from deploying properly, see
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1432758 ).

The Heat project has code to handle this kind of problem, but it's more
of a stopgap measure:

https://github.com/openstack/heat/commit/8ac7fa02063386a8eb73380d83261f7174781383

I think the better place to fix this is Nova. Unlike Heat, Nova knows
the domain name it uses and can truncate host names enough to leave room
for the domain name.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: hostname

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1614148

Title:
  sanitize_hostname() fails to account for domain part

Status in OpenStack Compute (nova):
  New

Bug description:
  The function nova.utils.sanitize_hostname() sanitizes instance names to
  make them suitable for use as host names. Among other things it contains
  the function truncate_hostname() that truncates host names to a maximum
  length of 63 characters. Unfortunately this truncation does not take
  into account the host names' domain part (DEFAULT/dhcp_domain in
  nova.conf).

  Consequently, a 63 character host name plus a domain part (e.g.
  `.novalocal`) will yield a 73 character net host name passed to
  cloud-init inside the instance, which can cause problems with host name
  setting code (this can prevent instances from deploying properly, see
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1432758 ).

  The Heat project has code to handle this kind of problem, but it's more
  of a stopgap measure:

  https://github.com/openstack/heat/commit/8ac7fa02063386a8eb73380d83261f7174781383

  I think the better place to fix this is Nova. Unlike Heat, Nova knows
  the domain name it uses and can truncate host names enough to leave room
  for the domain name.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1614148/+subscriptions


Follow ups